TypeError: Cannot set properties of undefined (setting ‘innerHTML‘)
Vue调用本地组件定义的变量,报错TypeError: Cannot set properties of undefined (setting ‘innerHTML‘),可能是回调函数内无法直接访问本地组件变量
的原因。
以下图片显示的代码,在vue的data -> return中定义了contentList这个变量,但是在回调函数中,console.log(this.contentList),浏览器端报错TypeError: Cannot set properties of undefined (setting ‘innerHTML‘),是因为回调函数无法发现本地变量
解决方案:
通过const self = this的方式,在回调函数外先获取本地组件引用,然后在回调函数内再进行使用和操作。
TypeError: Cannot set properties of undefined (setting ‘innerHTML‘)相关推荐
- Uncaught TypeError: Cannot set properties of undefined (setting ‘ innerHTML ) 问题
项目考核已经结束,我想分享一下我这次写项目的收获. 首先是"> Uncaught TypeError: Cannot set properties of undefined (sett ...
- TypeError: Cannot set properties of undefined (setting ‘xx‘)
TypeError: Cannot set properties of undefined (setting 'xx') 目录 TypeError: Cannot set properties of ...
- js代码中for循环里绑定onclick事件报错Uncaught TypeError Cannot set properties of undefined (setting ‘className‘)
jsfor循环里绑定onclick事件报错Uncaught TypeError Cannot set properties of undefined (setting 'className') 我想要 ...
- Vue TypeError: Cannot set properties of undefined (setting ‘msg‘) at eval (App.vue?91a0:25:1)
Vue TypeError: Cannot set properties of undefined (setting 'msg') at eval (App.vue?91a0:25:1) 这个问题是是 ...
- 【vue】文件批量上传报错问题解决Uncaught TypeError: Cannot set properties of undefined (setting ‘status‘)
一.问题描述 最近在vue项目上,使用el-upload组件实现多文件上传功能时出现了如下的报错内容. Uncaught TypeError: Cannot set properties of und ...
- Uncaught TypeError: Cannot set properties of null (setting ‘innerHTML‘)报错的一种
未捕获的类型错误:无法设置 null 的属性(设置 'innerHTML') 这种一般来说就是没有获取到该元素: 就好比html的ID名是files-list <ul id="file ...
- Error in nextTick: “TypeError: Cannot set properties of undefined (setting ‘checked‘)“
当看到nextTick的时候各位有没有想到$nextTick呢 这个报错正是需要通过使用$nextTick来解决 Vue 在更新 DOM 时是异步执行的.只要侦听到数据变化,Vue 将开启一个队列,并 ...
- Unhandled Rejection (TypeError): Cannot set properties of undefined (setting ‘xxx‘)报错问题
在react编码时,定义的方法多次调用时,出现以下this指向不存在报错问题 报错写法 解决方法,改成箭头函数写法
- Uncaught TypeError: Cannot set properties of undefined (setting ‘backgroundColor‘)的解决方法
前言 首先看代码: let colors = ['green', 'yellow', 'black', 'blue', 'pink', 'yellowgreen']let random = Math. ...
最新文章
- 无缓冲channel
- mysql 表的timestamp为自动添加
- UML中类之间的几种关系
- srs推flv流_srs流媒体服务器(simple rtmp server)如何支持h265
- rabbitmq怎么停止_如何停止从选择性队列中消费消息 – RabbitMQ
- 王道考研 计算机网络2 标准化工作
- 本地服务器的音乐如何才能播放视频文件夹,mx播放器如何添加本地文件 添加本地文件设置方法...
- WCF 入门调用实例教程
- java 生成Excel开门篇
- Eureka的元数据
- 虚拟机安装win7的ghost镜像系统
- ssq红蓝号码未出现间隔排序选号的回归计算中间率(红号出现3个以上再输出)
- 嵌入式神经网络处理器-NPU
- 更改我的网页默认的暴风影音播放器
- excel中图片导入mysql_把Excel的数据(文字、图片)导入MySQL数据库
- 流量负载_指挥流量:揭开互联网规模负载平衡的神秘面纱
- “视”不可挡:征兵招警,近视手术成“通关法宝”
- hive项目之微博ETL项目总结分析
- php学习(三):近几年来,不断发展的ThinkPhp框架(TP6)
- 这不是结束,而是另一次重逢的开始
热门文章
- 【转】VS2013动态库文件的创建及其使用详解
- SecureCRT无法使用root账户远程连接ubuntu
- 利用jquery 控制select 实例代码
- 【网络安全工程师面试合集】—谈一谈什么是网络安全?
- 量化干货:量化交易系统设计的六大细节
- 股票资金净流入和净流出
- arcgis 4.x graphicslayer点击事件_ArcGis中X、Y值的巧用方法小记
- 技术一般,却被破格提拔,背后肯定有黑幕?
- java 通过类名创建类,通过类名动态生成对象
- oracle mysql安装图解 linux_Linux上Oracle 11g安装步骤图文详解