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
vue 2.0.3 v-model not updating using an array #3958
Comments
I am looking into this. Seems selections do not get Observered correctly |
@peterkorgaard I update the fiddler here https://jsfiddle.net/defcc/a7vvz753/20/, You could use like this as a workaround. For more info, take a look at this http://vuejs.org/guide/reactivity.html#Change-Detection-Caveats |
I got the same question. @defcc Your solution can solve that we already know how many items of the model. If change the model from array to object, how can we do? |
You should use object type, as model binding uses model[index]= in internal implementation. If you use array type, the value could not be observed. http://vuejs.org/guide/list.html#Caveats You could init the selections when created, and update the selections after the selectBoxes data updated. I update the fiddler here https://jsfiddle.net/defcc/a7vvz753/21/ |
@defcc Bravo, this solution worked for me fine. Thank you so much! |
Thank you, @defcc, for clarifying this. I will use this workaround until the problem gets solved. And thanks for the great work everybody does on Vue. I'm really amazed. |
I'm in process migrating an application from Vue 1.x to 2.0.3. In this application I'm having several selects where each v-model binds to an individual index of an array . This is without problems in Vue 1.x but in version 2 it does not update. I believe this is a potential bug.
I have reproduced the problem here:
https://jsfiddle.net/peterkorgaard/a7vvz753/18/
Vue.js version
2.0.3
Reproduction Link
https://jsfiddle.net/peterkorgaard/a7vvz753/18/
Steps to reproduce
What is Expected?
What is actually happening?
The text was updated successfully, but these errors were encountered: