我在组件中使用"watch",就像:
watch: {
config:{
handler: function(){
this.colorAnalysis = this.$props.config;
},
deep: true,
immediate: true
},
它可以工作,但在下面显示消息:
此文件的声明发出要求使用私有名称"handler"。显式类型注释可以取消阻止声明发射。
我不知道问题出在哪里,以及如何防止这种情况。请给我指路。谢谢
我不知道原因。但当我将格式更改为:时
watch: {
config() {
this.colorAnalysis = this.$props.config;
},
}
消息消失了!