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安装解决了这个问题.
随机推荐
- 带有关键词的行 txt文本处理
原本的代码(只筛选出来自己要的)([python]文本处理:删除包含关键词的行.删除指定列.删除指定字符.替换关键字--_bandaoyu的博客-CSDN博客_python 删除csv还有特定词语的某 ...
- 学习-Vue3-绑定内联样式
<template> <div> <!-- 绑定内联样式--绑定对象 --> <!-- <div :style="{color: active ...
- ORCAD中,怎么一次性去掉所有元器件下面的下划线呢
选择元器件,右键找到unset单击就可以去掉了
- macOS NSScrollView简单使用
先看图片 这里是NSScrollView配合其他控件使用,我们这里只讲NSScrollView. 复制以下代码即可以运行 @interface ViewControl () /** 滚动显示 */ @ ...
- docker 文件编写,和jdk11运行java的Dockerfile文件
制作 docker文件 建立 Dockerfile 文件 拷贝jar文件到 新目录下 FROM openjdk:8 MAINTAINER TsuiChris COPY *.jar /app.jar E ...
- nginx配置文件过大导致起不来
更改src/core/ngx_conf_file.c,默认只有4k,将下面值改大重新编译
- dart extends 覆盖规则
1,不覆写super的变量,child会自动继承super的变量.即使是在child里给super赋值,child里也是可以访问到的,可能是因为引用的关系. 2,只要覆写了super的变量,只给sup ...
- 高德地图poi关键字搜索-vue+ant-design
最近有个需求,需要输入上车点,下车点,然后输入上车点的时候还要在下方显示地图附近的车辆.百度了一波之后,完全莫得头绪,很多代码也都用不了,即便改了之后也不怎么生效.我用的是jeecg-boot.最后静 ...
- Flink Application Development DataStream API Operators Overview-- Flink应用程序开发DataStream API操作符概览
目录 概览 DataStream转换 物理分区 任务链和资源组 翻译原文- Application Development DataStream API Operators 概览 操作符将一个或多个D ...
- 为什么常用Formdata对象来上传图片
一.上传的数据体格式Content-Type 1.application/x-www-form-urlencoded 2.application/json 3.multipart/form-data ...