miniprogram-to-uniapp
miniprogram-to-uniapp copied to clipboard
子组件内使用setData和emit函数报 TypeError: this.$forceUpdate is not a function 错误
问题描述?
组件内包含的子组件,在使用this.setData和this.$emit的时候,会报 TypeError: this.$forceUpdate is not a function 错误
重现步骤
在u-child-comp组件的methods 下创建函数,如
methods: { updateData(obj){ this.setData({obj}) },
change(type){
this.$emit('changeType', {
detail: {
type
}
});
}
}
期望的结果
在子组件也正常使用setData和this.$emit