Hello I am trying to use vue-select with vue 2.1.10. It doesnt sync value and also value prop inside component is null.
<v-select :options="['foo','bar','baz']" :value.sync="test_select"></v-select>
.sync is removed in vue 2. Props in components are now one-way, and immutable after instantiation. You need to use the v-model syntax instead:
<v-select :options="['foo','bar','baz']" v-model="test_select"></v-select>
Got it, Thank you :+1:
No problem!
Could you update the documentation under https://sagalbot.github.io/vue-select/#install regarding ".sync"? Or maybe add a note for vue2.
Thanks!
@haubix yes, definitely. I'm in the process of rebuilding the docs out of markdown right now - I launched v2 before the docs were done because I was getting so many requests for it, so they're sort of in limbo right now. I'll make sure that's noted when they're updated.
.sync has been reintroduced as syntatic suger on 2.3.0
https://vuejs.org/v2/guide/components.html#sync-Modifier
In 2.3.0+ we re-introduced the .sync modifier for props, but this time it is just syntax sugar that automatically expands into an additional v-on listener:
...
For the child component to update foo鈥榮 value, it needs to explicitly emit an event instead of mutating the prop:
this.$emit('update:foo', newValue)
Dear @sagalbot ,
I play around :value.sync for few times and it doesn't work (vue 2.4.4), but fortunately v-model work well.
Do you plan to reintroduce :value.sync ?
Most helpful comment
.syncis removed invue 2. Props in components are now one-way, and immutable after instantiation. You need to use thev-modelsyntax instead: