[Vuejs]-How to bind the value separately returned from the component

0👍

You can use v-model instead of passing props, as you want two way data binding between your parent and child component. If you look at docs,

<input v-model="something">

is just syntactic sugar for:

<input v-bind:value="something" v-on:input="something = $event.target.value">

So for a component to work with v-model, it must:

  • accept a value prop
  • emit an input event with the new value

I have modified your fiddle with these changes, have a look here.

Leave a comment