elementUI使用tree报错Cannot read property ‘setCheckedKeys‘ of undefined“
程序员文章站
2022-06-07 13:12:32
...
报错是因为dom还没有加载完,就已经赋值了,所以才会报错的
解决方案:
this.$nextTick(() => {
this.$refs.tree.setCheckedKeys('要赋值的数组')
});
附:因为我的tree是写在弹窗中的,如果弹窗不出现的话,dom也是没有加载的状态,所以要把弹窗出现写在前面,解决方案写在后面,才是万全之策。
上一篇: 使用Element-UI的DateTimePicker组件报错:Cannot read property 'getHours' of undefined
下一篇: Java 8 新特性:Optional类
推荐阅读
-
js 报错 Uncaught TypeError: Cannot read property 'trim' of undefined
-
webpack报错Cannot read property 'presetToOptions' of undefined
-
el-tooltip组件中content使用Vue-i18n报错TypeError: Cannot read property ‘$t‘ of null
-
vuejs路由使用的问题Error in render function: "TypeError: Cannot read property 'matched' of undefined"
-
vue3 使用axios 会报错“Uncaught TypeError: Cannot read property ‘get‘ of undefined”
-
报错:Cannot read property ‘push‘ of undefined
-
angular 1做项目时 报错TypeError: Cannot read property 'then' of undefined
-
js或jquery报错Cannot read property 'length' of undefined(Cannot read property 'rows' of null)
-
Vue坑点 在Vue中引入Echarts报错 Cannot read property ‘init‘ of undefined
-
Vue框架的学习中,使用substring方法时提示:Uncaught TypeError: Cannot read property ‘substring‘ of undefined的解决方法