[Vuejs]-Why can't component update when it is bound to an Array via v-model?

0👍

You need to use watcher on the passed props: value as following:

watch:{
  value: function(val){
     this.text = val.join(',')
  }
}

and also use v-model in the component:

template: '<input type="text" @input="onInputText" placeholder="Enter comma separated array" v-model="text" />',

See working demo: http://jsfiddle.net/h313j5sh/7/

Updated block in not working as it’s scope is limited till it’s own component only, it will not affect DOM of other component.

Leave a comment