Vue's v-model: Two-Way Binding Made Simple
v-model creates a two-way binding that synchronizes form inputs with your JavaScript data. Use it on any form element like an input or textarea. The footgun: it ignores initial HTML attributes; your JavaScript state is always the single source of truth.
v-model is syntactic sugar that creates a two-way data binding, synchronizing a form input with your JavaScript state. Think of it as a dedicated channel where UI changes update data, and data changes update the UI. It's the standard for handling user input in Vue on `<input>`, `<textarea>`, and `<select>` elements. The footgun: `v-model` always ignores initial HTML attributes like `value` or `checked`; you must declare the initial value in your component's JavaScript data.
Read the original → vuejs.org
- #vue
- #frontend
- #data-binding
- #forms
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.