[Vuejs]-The use of bidirectional binding of components in Vue.js

0👍

According to DOCS:

For a component to work with v-model, it should (these can be
configured in 2.2.0+):

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

This can be configured sinse 2.2.x with a model options block:

Vue.component('currency-input', {
  model: {
    prop: 'propValue',
    // event: 'input'  - you can also customize event name, not needed in your case
  },

With this in place, your code will work again: https://jsfiddle.net/wostex/j3a616a5/

Leave a comment