0 votes
in Vue.JS by (883 points)

How do you implement two-way binding?

1 Answer

0 votes
by (883 points)

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">
<p>The message is: {{ message }}</p>

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

Related questions