当前位置:网站首页>异常情况处置方案
异常情况处置方案
2022-07-30 14:20:00 【shewlong】
异常情况处置方案
文章目录
vue
ref
1.vscode报错 ‘show‘ does not exist on type ‘Vue | Element | Vue[] | Element[]‘. Property ‘show‘ do
this.$refs.modal.show
解决方法:将类型进行转换
(this.$refs.modal.show as any).show()
补充:
- ref
ref 被用来给元素或子组件注册引用信息。引用信息将会注册在父组件的 $refs 对象上。如果在普通的 DOM 元素上使用,引用指向的就是 DOM 元素;如果用在子组件上,引用就指向组件实例:
<!-- `vm.$refs.p` will be the DOM node -->
<p ref="p">hello</p>
<!-- `vm.$refs.child` will be the child component instance -->
<child-component ref="child"></child-component>
当 v-for 用于元素或组件的时候,引用信息将是包含 DOM 节点或组件实例的数组。
关于 ref 注册时间的重要说明:因为 ref 本身是作为渲染结果被创建的,在初始渲染的时候你不能访问它们 - 它们还不存在!$refs 也不是响应式的,因此你不应该试图用它在模板中做数据绑定。
- $ref
一个对象,持有注册过 ref attribute 的所有 DOM 元素和组件实例。
antD
form表单相关
1.Error in v-on handler: “TypeError: Cannot read property ‘resetFields‘ of undefined“
解决方法:对话是一个虚拟dom,visible!==true之前,dom未挂载在根节点上,此时refs的
原因:对话框表单未挂载到根节点上,导致无法识别resetFields方法
解决方法:
- resetfileds方法无法使用,让对话框完全开启后再使用resetfileds方法
this.visible = true;
(this.$refs.ruleForm as any).reserFields(); //ts语法,js可去掉类型转换
- ($nextTick dom下一次更新之后)
resetForm(formName) {
this.$nextTick(()=>{
this.$refs[formName].resetFields();
})
},
- (如果是第一次就点击新增就没必要reset, 根据元素undefined判断)
if (this.$refs[formName] !== undefined) {
this.$refs[formName].resetFields();
}
注意事项:对DOM一系列的js操作最好都要放进Vue.nextTick()的回调函数中
边栏推荐
- What should I do if the sql server installation fails (what should I do if the sql server cannot be installed)
- 自动化办公|办公软件和亿图脑图MindMaster快捷键
- Application of time series database in the field of ship risk management
- 【Vue.js 3.0源码】KeepAlive 组件:如何让组件在内存中缓存和调度?
- The main content of terrain analysis (the special effect level of the wandering earth)
- #第九章 子查询课后习题
- English语法_不定代词 - both / either / neither
- BI-SQL丨WHILE
- Flask Framework - Sijax
- pytorch与keras的相互转换(代码以LeNet-5为例)
猜你喜欢

以unity3d为例解读:游戏数据加密

时间序列的数据分析(四):STL分解

八年测试经验,为何惨遭领导痛批:你写的测试文档还不如刚来的应届生

打破原则引入SQL,MongoDB到底想要干啥?

百家号取消接口发文功能:插外链获权重被堵死

What is the relationship between the construction of smart cities and 5G technology in the new era

DocuWare 文件管理与工作流程自动化案例研究——DocuWare 工作流程功能使在家工作的员工能够保持沟通和高效工作,支持混合环境

MongoDB启动报错 Process: 29784 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)

基于FPGA的DDS任意波形输出

元宇宙邮局AI航天主题系列数字藏品 将于7月30日10:00点上线“元邮数藏”
随机推荐
DDS Arbitrary Waveform Output Based on FPGA
Remember an experience of interviewing an outsourcing company, should you go?
What should I do if the sql server installation fails (what should I do if the sql server cannot be installed)
Application of time series database in the field of ship risk management
MongoDB启动报错 Process: 29784 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=14)
Hello,World
Understand the Chisel language. 29. Chisel advanced communication state machine (1) - communication state machine: take the flash as an example
Baijiahao cancels the function of posting documents on the interface: the weight of the plug-in chain is blocked
八年测试经验,为何惨遭领导痛批:你写的测试文档还不如刚来的应届生
PyQt5快速开发与实战 9.1 使用PyInstaller打包项目生成exe文件
The highest level of wiring in the computer room, the beauty is suffocating
3年软件测试经验面试要求月薪22K,明显感觉他背了很多面试题...
打破原则引入SQL,MongoDB到底想要干啥?
Flask Framework - Flask-Mail Mail
SLF4J的使用
机房布线的至高境界,美到窒息
Machine learning difference in the competition and industry application
网站添加能换装可互动的live 2d看板娘
The truth of the industry: I will only test those that have no future, and I panic...
MaxWell抓取数据