FrontendDeveloper.in

Vue.js Track Detail

How do you implement two-way binding?

You can use the v-model directive to create two-way data bindings on form input, textarea, and select elements.

Lets take an example of it using input component,

<input v-model="message" placeholder="Enter input here">

Remember, v-model will ignore the initial value, checked or selected attributes found on any form elements. So it always use the Vue instance data as the source of truth.