Questions tagged [v-model]

Use this tag for questions related to the v-model directive of Vue.js.

The v-model directive is used to create two-way data bindings on form input, textarea, and select elements. It automatically picks the correct way to update the element based on the input type. Although a bit magical, v-model is essentially syntax sugar for updating data on user input events. For more information: https://vuejs.org/v2/guide/forms.html#Modifiers

420 questions
50
votes
7 answers

Should we use v-model to modify Vuex store?

Hello I am beginner in Vue and I do have a problem that's really bugging me. I am wondering should we use v-model directive to modify vuex store? Vuex says that we should modify vuex store only by mutations but v-model makes everything easier and…
Krzysztof Kaczyński
  • 4,412
  • 6
  • 28
  • 51
38
votes
2 answers

What is the difference between v-model and .sync when used on a custom component

I don't understand the difference between v-model and .sync used on a component. V-model is a shorthand for binding a variable (myVar) to the component property 'value' and listening to the 'input' event emitted from…
Peter Petrus
  • 699
  • 3
  • 8
  • 15
23
votes
3 answers

How to use v-model on component in vue 3 script setup

I want to add a v-model on a component but I got this warning: [Vue warn]: Component emitted event "input" but it is neither declared in the emits option nor as an "onInput" prop. Here is my code: // Parent.vue