控制台报错信息
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.
解决办法
  1. methods 是否写成 method
  2. 父组件监听子组件 $emit 事件不需要指定参数
// 错误 -> onChange(val)
<el-dropdown @change="onChange(val)"></el-dropdown>

// 正确
<el-dropdown @change="onChange"></el-dropdown>
...
methods: {
	onChange(val) { }
}
Logo

前往低代码交流专区

更多推荐