Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toggle button stuck on switch #130

Open
TTraian opened this issue Jan 30, 2020 · 2 comments
Open

Toggle button stuck on switch #130

TTraian opened this issue Jan 30, 2020 · 2 comments

Comments

@TTraian
Copy link

TTraian commented Jan 30, 2020

Hello. After last update (1.3.3) if you have an code like in the example your button will be stuck. As i can see,it is because on (value) property there is no variable to watch and is a boolean value. Maybe someone have the same issue like me after update. I remove the (sync) property for this case and everything is working fine right now.

<toggle-button :value="false" color="#82C7EB" :sync="true" :labels="true"/>

@TTraian TTraian changed the title Toggle button switch Toggle button stuck on switch Jan 30, 2020
@Aviglik91
Copy link

Hey,
When using :sync="true" looks like you are telling the toggle-button component to watch for changes in the object you are passing to :value prop

Which in your case is just "false" and thats why nothing really happens when you click the button

Here is an exmaple

// HTML
<toggle-button :value="data_property" color="#82C7EB" :sync="true" :labels="true"  @change="changeDataProperty($event.value)" />


// VUE
changeDataProperty: function(event){

            (event) ?  this.data_property = true :  this.data_property = false  ;

        }

@TTraian
Copy link
Author

TTraian commented Feb 10, 2020

Hey,
When using :sync="true" looks like you are telling the toggle-button component to watch for changes in the object you are passing to :value prop

Which in your case is just "false" and thats why nothing really happens when you click the button

Here is an exmaple

// HTML
<toggle-button :value="data_property" color="#82C7EB" :sync="true" :labels="true"  @change="changeDataProperty($event.value)" />


// VUE
changeDataProperty: function(event){

            (event) ?  this.data_property = true :  this.data_property = false  ;

        }

Hi. I mention that because in the Readme file the example is wrong, and I agree with you. But in the past I used the code wrong and it works very well. After the update 1.3.3, that bug was fixed and if you still use the example code, the one with :value="false" and :sync="true" your buttons will go crazy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants