Vue · Junior · Question 25 of 75
What does v-model on an input do?
<input v-model="name" />
<p>Hello, {{ name }}</p>- ✓Correct answer: Two-way binding: it sets the input's value from state and updates state on input
- 2Binds the value once when the component mounts
- 3Validates the input
Explanation
On a text input v-model is sugar for :value="name" @input="name = $event.target.value". For checkboxes, radios and selects Vue uses the right property and event automatically.