如果我们给v-bind添加了sync,那么子组件中就有一个事件可以触发 update:xxx自定义事件并且传递要修改的值
<child v-bind:m.sync="data中的值"></child>
const child = {
template: ``,
methods: {
handler () {
this.$emit('updata:m', 要修改的值)
}
}
}
Vue.component('child', child)
如果我们给v-bind添加了sync,那么子组件中就有一个事件可以触发 update:xxx自定义事件并且传递要修改的值
<child v-bind:m.sync="data中的值"></child>
const child = {
template: ``,
methods: {
handler () {
this.$emit('updata:m', 要修改的值)
}
}
}
Vue.component('child', child)