我在写vue项目的时候,点击按钮,会报错Error in nextTick: "TypeError: Cannot read property 'execRowDataApi' of undefined
如下图所示:
解决方法:加上if判断,先判断是否存在,如果存在执行,否则不执行
reloadTable() {
this.$nextTick(() => {
console.log(999)
if (this.$refs.ruleTable){
this.$refs.ruleTable.execRowDataApi()
this.$refs['ruleForm'] && this.$refs['ruleForm'].clearValidate()
}
})
},