Vue-select: Value is not sync to data

Created on 28 Feb 2017  路  7Comments  路  Source: sagalbot/vue-select

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>

Most helpful comment

.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>

All 7 comments

.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 ?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fabianmieller picture fabianmieller  路  3Comments

FrozenIce0617 picture FrozenIce0617  路  3Comments

NexoraSolutions picture NexoraSolutions  路  3Comments

edalzell picture edalzell  路  3Comments

rudykaze picture rudykaze  路  3Comments