vue报错 Property or method "***" is not defined on the instance but referenced but referenced during.
控制台报错信息Property or method "showData" is not defined on the instance butreferenced during render. Make sure that this property is reactive,either in the data option, or for class-based components,...
·
控制台报错信息
Property or method "showData" is not defined on the instance but
referenced during render. Make sure that this property is reactive,
either in the data option, or for class-based components, by
initializing the property. See:
https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.
解决办法
- methods 是否写成 method
- 父组件监听子组件 $emit 事件不需要指定参数
// 错误 -> onChange(val)
<el-dropdown @change="onChange(val)"></el-dropdown>
// 正确
<el-dropdown @change="onChange"></el-dropdown>
...
methods: {
onChange(val) { }
}
更多推荐
已为社区贡献1条内容
所有评论(0)