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

Sync doesn't work as expected, value/v-model can get out of sync #79

Open
aldencolerain opened this issue Aug 27, 2018 · 5 comments
Open

Comments

@aldencolerain
Copy link
Contributor

If I have the toggle in sync mode connected to a value using v-model (or :value and @input) the toggle can get out of sync of the value.

When sync is selected the toggle function could not set this.toggled = !this.toggled directly, but could just send the value through the input event and let the parent's v-model handler set the value.or quickly changes.

@aldencolerain
Copy link
Contributor Author

aldencolerain commented Aug 27, 2018

Maybe something like...

toggle (event) {
  if (!this.sync) {
    this.toggled = !this.toggled;
  }
  this.$emit('input', this.toggled);
  this.$emit('change', {
    value: this.toggled,
    srcEvent: event
  });
}

@pineapplegum
Copy link

Is there any way to get around this issue in the current version?

@YuryKorovko
Copy link

@Stanleyck Try to remove v-model and leave only value and set sync = true. Then, there is exist change event that you can use to change the field of your model avoiding v-model

@veebuv
Copy link
Contributor

veebuv commented Mar 27, 2019

Just saw @aldencolerain 's comment right now - made a PR - happy to add you to it :)

@soknifedev
Copy link

is there any update on this?

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

5 participants