欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

element表单重置

程序员文章站 2022-05-04 16:53:43
...

当使用添加的对话框表单时使用来重置表单数据

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

编辑的时候需要重置时使用

this.$nextTick(() => { 
	this.$refs['form'].clearValidate() 
})

还有网上找的这个办法,但是我使用的时候会把我的表单验证去掉

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