一、子组件向父组件传递一个值
子组件:
this.$emit('change', this.value);
父组件:
<!-- 在父组件中使用子组件 -->
<editable-cell :text="text" :inputType="inputType" @change="costPlannedAmountChange($event)" />
async costPlannedAmountChange(value) {
console.log(value)
}
在使用子组件时,绑定change函数的事件处理函数也可以写成如下格式:
<editable-cell