给树节点赋值时,执行下面代码会报错,原因是: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"的更多相关文章

  1. 小程序 for循环 报错 Cannot read property 'total' of undefined

    for循环一直报错  Cannot read property 'total' of undefined,但total在起初是有定义的,后来找到了问题,是i<=的问题,改为<不报错了. i ...

  2. 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 ...

  3. vue.config.js报错cannot set property "preserveWhitespace" of undefined

    vue.config.js报错cannot set property "preserveWhitespace" of undefined 最近在项目中配置webpack,由于vue ...

  4. vue项目中使用echarts map报错Cannot read property 'push' of undefined nanhai.js

    在vue中绘制地图需要加载一个本地china.json文件,我用的是get请求的方法加载的,而不是直接import,因为我怕import请求到的部署到线上的时候会有问题.如下是get请求方法: thi ...

  5. [Element-UI] 使用Element-UI的DateTimePicker组件报错:Cannot read property 'getHours' of undefined

    使用Element-UI组件的DateTimePicker,如下: <template> <div class="block"> <span clas ...

  6. echarts报错Cannot read property 'features' of undefined

    引入地图的时候 echarts2报错: Uncaught Error: [MODULE_MISS]"echarts/src/util/mapData/params" is not ...

  7. Vue tools开发工具报错Cannot read property '__VUE_DEVTOOLS_UID__' of undefined

    使用 vue tools 开发工具,不显示调试面板中的组件,点击控制台报错: Cannot read property 'VUE_DEVTOOLS_UID' of undefined 在 main.j ...

  8. 使用vue-preview报错Cannot read property 'open' of undefined

    最近在做一个vue项目中时,需要使用vue-preview插件制作缩略图,首先在终端使用npm i vue-preview -S指令安装了vue-preview插件,然后在main.js中,导入并引用 ...

  9. vue 报错 Cannot read property '__ob__' of undefined的解决方法

    记不清第n次遇到这个错误了,但是脑子就是不好用,记不住解决办法啊,每次都要找好久才能找到错误,网上还一篇篇的全是错误答案......所以写篇随笔,记录下,方便大家也方便我自己. 网上有人说是组件循环了 ...

  10. webpack报错Cannot read property 'presetToOptions' of undefined

    在学习react全家桶时,webpack首先报错,报错内容如下,最后我是因为没有全局安装webpack导致的报错,使用npm install webpack -g安装解决了这个问题.

随机推荐

  1. oracle 索引创建

    --查询表里的索引 select t.*,i.index_type from user_ind_columns t,user_indexes i where t.index_name = i.inde ...

  2. 在windows上搭建spark遇到的问题

    报错如下: The root scratch dir: /tmp/hive on HDFS should be writable. Current permissions are: --------- ...

  3. 2021 icpc 沈阳 I 【分式线性变换的保交比性】

    分式线性变换的保交比性 对于分式线性变换,具有保交比性 应用 在复数域下,存在分式线性变换,给定三个输入和输出,再给定第四个输入,求其在这个分式线性变换下的输出. https://codeforces ...

  4. Webrtc audio

    整体理解 在 WebRTC 中,Call 是peer connection 的. 为 WebRTC Call 注入的 AudioState 来自于全局的 MediaEngine 的 VoiceEngi ...

  5. Debian 迁移到新硬盘

    老硬盘 A,新硬盘 B,先把B分好区,做好格式化. 准备虚拟机一台,Linux LiveCD光盘或者可用的Linux虚拟机系统,把硬盘A B 映射成虚拟机可以使用的硬盘文件,根据LiveCD新建相应的 ...

  6. ubuntu22.04LTS下编译glfw

    环境准备 # 预装cmake sudo apt install cmake # 下载源码 git clone https://github.com/glfw/glfw.git 编译 # cmake初始 ...

  7. gorm去重查询 iris框架

    写练习 demo 时遇到需要进行去重查询,gorm没有db.distinct()的写法 // 数据库的表字段 type Pro_location_relation struct { Id int64 ...

  8. MSSQL Always Encrypted 加密

    载自:https://zhuanlan.zhihu.com/p/63674006 文档资源:https://docs.microsoft.com/zh-CN/sql/relational-databa ...

  9. 4K60帧!RayLink远程控制软件如何帮助设计师远程办公?

    司机在家能远程工作吗?大写的"能"!!!如果你听说过司机远程办公,那你一定对下面这张图不陌生~ (远程办公的叉车司机) 这张图展示的是负责在库房工作的叉车司机在非办公区域远程办公的 ...

  10. nginx auth_basic uwsgi 目录简易认证。

    mkdir /etc/nginx/conf.d/auth_pwd touch /etc/nginx/conf.d/auth_pwd/xx.pwd htpasswd -c -d /etc/nginx/c ...