当前位置:网站首页>Cannot read properties of null (reading ‘insertBefore‘)
Cannot read properties of null (reading ‘insertBefore‘)
2022-08-04 05:24:00 【小东西的东西】
一、报错现象
vue3 + element plus 项目,本地启动时,页面进行所有操作都正常;部署到生产环境后,数据驱动DOM变化的操作会导致如下报错。
二、可能原因及解决方案
经过分析出现报错的操作步骤及多方资料查询,不同情况下的报错,其原因不同。遇到这种问题的同学可以从以下几方面进行排查。
1、v-if 导致
在 v-if 值为 false 时,如果操作了 v-if 控制的 DOM,可能会因为该 DOM 元素不存在而报错。
解决方案:v-show 替换 v-if
2、el-dialog 组件导致
默认弹框是关闭的,DOM中没有弹框中的内容。打开弹框再关闭后,弹框中的 DOM 元素没有被销毁,可能会因为不该存在的 DOM 元素而报错(我的报错就是由此导致)。
解决方案:给 el-dialog 组件增加 destroy-on-close 属性
3、el-table 组件导致
el-table-column渲染时报错,若 scope.row.field(field为任意字段值)不存在,对其直接执行 length、toString() 等方法而报错。
解决方案:scope.row.field.length
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
- 力扣:343. 整数拆分
- Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
- [Skill] Using Sentinel to achieve priority processing of requests
- 使用Loadrunner进行性能测试
- C Expert Programming Chapter 4 The Shocking Fact: Arrays and pointers are not the same 4.2 Why does my code not work
- 如何打造一篇优秀的简历
- 【一步到位】Jenkins的安装、部署、启动(完整教程)
- 信息学奥赛一本通 1312:【例3.4】昆虫繁殖
- The idea setting recognizes the .sql file type and other file types
- 详解八大排序
猜你喜欢

Towards Real-Time Multi-Object Tracking(JDE)
![[C language advanced] program environment and preprocessing](/img/ac/a13dd2cc47136d4938b6fc7fad660c.png)
[C language advanced] program environment and preprocessing

The difference between px, em, and rem

使用Loadrunner进行性能测试

Mini program + e-commerce, fun new retail

The idea setting recognizes the .sql file type and other file types

深度学习21天——卷积神经网络(CNN):实现mnist手写数字识别(第1天)
![[21 Days Learning Challenge] Image rotation problem (two-dimensional array)](/img/51/fb78f36c71e1eaac665ce9f1ce04ea.png)
[21 Days Learning Challenge] Image rotation problem (two-dimensional array)

TSF微服务治理实战系列(一)——治理蓝图

Turn: Management is the love of possibility, and managers must have the courage to break into the unknown
随机推荐
C Expert Programming Chapter 5 Thinking about Linking 5.2 Advantages of Dynamic Linking
Hangdian Multi-School-Slipper- (tree map conversion + virtual point mapping)
What are the functions of mall App development?
DataTable uses Linq for grouping and summarization, and converts the Linq result set into DataTable
心余力绌:企业面临的软件供应链安全困境
【云原生--Kubernetes】Pod资源管理与探针检测
商城系统APP如何开发 都有哪些步骤
[Cocos] cc.sys.browserType可能的属性
FPGA学习笔记——知识点总结
System design. Seckill system
力扣:62.不同路径
See how DevExpress enriches chart styles and how it empowers fund companies to innovate their business
Cache pool of unity framework
C专家编程 第4章 令人震惊的事实:数组和指针并不相同 4.5 数组和指针的其他区别
离线采集怎么看sql执行计划
5个开源组件管理小技巧
力扣:343. 整数拆分
Landing, the IFC, GFC, FFC concept, layout rules, forming method, use is analysed
DP4398:国产兼容替代CS4398立体声24位/192kHz音频解码芯片
动态规划总括
