当前位置:网站首页>【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”
【解决报错】Error in v-on handler: “TypeError: Cannot read property ‘resetFields’ of undefined”
2022-04-23 16:53:00 【栀妹儿】
vue项目用elm框架写表单
在新增的时候一般要让数据清空this.$refs['form'].resetFields();
但是在页面加载进来的时候还没有渲染dom元素
所以直接点新增会报错:
Error in v-on handler: "TypeError: Cannot read properties of undefined (reading 'resetFields')"
解决方案:
1、加判断
if(this.$refs['form'] !== undefined) {
this.$refs['form'].resetFields();
}
2、延迟回调
this.$nextTick(() => {
this.$refs['form'].resetFields();
})
版权声明
本文为[栀妹儿]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_38990605/article/details/124338946
边栏推荐
- PostgreSQL列存与行存
- Detailed explanation of UWA pipeline function | visual configuration automatic test
- Detailed explanation of Niuke - Gloves
- Getting started with JDBC
- 磁盘管理与文件系统
- PostgreSQL column storage and row storage
- About background image gradient()!
- 关于 background-image 渐变gradient()那些事!
- MySql主从复制
- ByteVCharts可视化图表库,你想要的我都有
猜你喜欢
安装及管理程序
Node access to Alipay open platform sandbox to achieve payment function
扫码登录的原理你真的了解吗?
Take according to the actual situation, classify and summarize once every three levels, and see the figure to know the demand
True math problems in 1959 college entrance examination
Deepinv20 installation MariaDB
DDT + Excel for interface test
人脸识别框架之dlib
DanceNN:字节自研千亿级规模文件元数据存储系统概述
Use itextpdf to intercept the page to page of PDF document and divide it into pieces
随机推荐
Do you really understand the principle of code scanning login?
Knowledge points and examples of [seven input / output systems]
How does flash cache data in memory?
English | day15, 16 x sentence true research daily sentence (clause disconnection, modification)
VLAN高级技术,VLAN聚合,超级Super VLAN ,Sub VLAN
Dlib of face recognition framework
Construction of promtail + Loki + grafana log monitoring system
Kunteng full duplex digital wireless transceiver chip kt1605 / kt1606 / kt1607 / kt1608 is suitable for interphone scheme
【PIMF】OpenHarmony啃论文俱乐部—在ACM Survey闲逛是什么体验
Easyexcel reads the geographical location data in the excel table and sorts them according to Chinese pinyin
聊一聊浏览器缓存控制
英语 | Day15、16 x 句句真研每日一句(从句断开、修饰)
Nacos detailed explanation, something
计组 | 【七 输入/输出系统】知识点与例题
伪分布安装spark
◰GL-着色器处理程序封装
Solution of garbled code on idea console
Tencent resolves the address according to the IP address
Selenium IDE and XPath installation of chrome plug-in
众昂矿业:萤石浮选工艺