3 ms·
As discussed in https://vuejs.org/v2/guide/components.html#Using-v-model-on-Components https://vuejs.org/v2/guide/components.html#Using-v-model-on-... <Compo
by orangecat 8y ago
As discussed in https://vuejs.org/v2/guide/components.html#Using-v-model-on-Components https://vuejs.org/v2/guide/components.html#Using-v-model-on-...
<Component v-model="foo">
is basically shorthand for
<Component :value="foo" @input="foo=$event">
In particular, the child can't affect the value of the parent's "foo" attribute except by sending an event. This is in contrast to Angular 1 where changing "foo" in the child would also change it in the parent, which would often lead to confusing data flow cycles.