elementUI el-tree报错 Cannot read property ‘setCheckedKeys’ of undefined"
给树节点赋值时,执行下面代码会报错,原因是:DOM元素未加载完成.
以下为错误写法。
handleRowClick(row)
{ this.$refs.tree.setCheckedKeys(ids); }
handleRowClick(row)
{
this.$nextTick(() =>{
this.$refs.tree.setCheckedKeys(ids);
})
以上为正确写法,属于延迟回掉,但是也可能会报以上错误,还是在dom未加载完成。
SetTimeout(()=>{
this.$refs.tree.setCheckedKeys(ids);
})
elementUI el-tree报错 Cannot read property ‘setCheckedKeys’ of undefined"的更多相关文章
- 小程序 for循环 报错 Cannot read property 'total' of undefined
for循环一直报错 Cannot read property 'total' of undefined,但total在起初是有定义的,后来找到了问题,是i<=的问题,改为<不报错了. i ...
- datatables 多一列报错Cannot read property 'sWidth' of undefined(…)/少一列报错Cannot read property 'style' of undefined(…)
datatables 多一列报错Cannot read property 'sWidth' of undefined(…)/少一列报错Cannot read property 'style' of u ...
- vue.config.js报错cannot set property "preserveWhitespace" of undefined
vue.config.js报错cannot set property "preserveWhitespace" of undefined 最近在项目中配置webpack,由于vue ...
- vue项目中使用echarts map报错Cannot read property 'push' of undefined nanhai.js
在vue中绘制地图需要加载一个本地china.json文件,我用的是get请求的方法加载的,而不是直接import,因为我怕import请求到的部署到线上的时候会有问题.如下是get请求方法: thi ...
- [Element-UI] 使用Element-UI的DateTimePicker组件报错:Cannot read property 'getHours' of undefined
使用Element-UI组件的DateTimePicker,如下: <template> <div class="block"> <span clas ...
- echarts报错Cannot read property 'features' of undefined
引入地图的时候 echarts2报错: Uncaught Error: [MODULE_MISS]"echarts/src/util/mapData/params" is not ...
- Vue tools开发工具报错Cannot read property '__VUE_DEVTOOLS_UID__' of undefined
使用 vue tools 开发工具,不显示调试面板中的组件,点击控制台报错: Cannot read property 'VUE_DEVTOOLS_UID' of undefined 在 main.j ...
- 使用vue-preview报错Cannot read property 'open' of undefined
最近在做一个vue项目中时,需要使用vue-preview插件制作缩略图,首先在终端使用npm i vue-preview -S指令安装了vue-preview插件,然后在main.js中,导入并引用 ...
- vue 报错 Cannot read property '__ob__' of undefined的解决方法
记不清第n次遇到这个错误了,但是脑子就是不好用,记不住解决办法啊,每次都要找好久才能找到错误,网上还一篇篇的全是错误答案......所以写篇随笔,记录下,方便大家也方便我自己. 网上有人说是组件循环了 ...
- webpack报错Cannot read property 'presetToOptions' of undefined
在学习react全家桶时,webpack首先报错,报错内容如下,最后我是因为没有全局安装webpack导致的报错,使用npm install webpack -g安装解决了这个问题.
随机推荐
- VKM4 批准功能对应 bapi
追踪代码发现function都在这里, SD_ORDER_CREDIT_RELEASE RVALVFORMS CALL FUNCTION 'MESSAGE_TEXT_BUILD' EXPORTI ...
- thirty-two(模型点击展示)react-three-fiber
模型点击蒙版展示 点击展示目的(用户需要看见模型中更加多的内容信息) 使用技术 ThreeJs.React-three-fiber.React-three-drei.React.css 整体思路: ...
- GNOME 窗口添加最大化、最小化按钮
1.安装工具 使用终端命令安装优化工具 yum install gnome-tweak-tool 2.配置 gnome-tweak-tool 安装完毕后,在应用程序的"工具"中找到 ...
- Go实现KMP和Sunday算法
KMP 1 func KMP(str, substr string) int { 2 if substr == "" { 3 return 0 4 } 5 strLen := le ...
- RayLink 远控软件又推出 2 个重磅宝藏功能免费用
你有没有在远程办公时,担心他人偷窥电脑?以致于保密性资料或私密信息,遭到泄露.创意被剽窃......又或是遇到过邻座同事屏幕前明明没人,鼠标箭头却自个浏览起网页的惊悚画面? 如果你有上述情况,建议使用 ...
- HttpClient详细使用示例(转)
https://blog.csdn.net/justry_deng/article/details/81042379
- 在C++创建动态数组
计算首行两数相加 #include <iostream>11 #include <vector> using namespace std; int main() { vecto ...
- RR|RC隔离级别下行锁的情况
测试准备 test库下建表tt CREATE TABLE `tt` ( `id` int(11) NOT NULL, `code` int(11) DEFAULT NULL, `name` varch ...
- Asp.Net Core中使用日志组件log4net
我们在开发任何项目过程中,记录各种日志是太正常不过的事情.没有日志记录的项目,也不可能放心进入生产环境运行.因此日志的记录,是必须要做的. 在.NET开发中,log4net是个常用的日志组件.本文简单 ...
- Something Just Like This
I've been reading books of old我遍读旧籍 The legends and the myths那些古老传奇和无边神秘 Achilles and his gold如阿喀琉斯和 ...