Scenes
When usingel-dialog
, you need to clear the form content and verification rules in the pop-up window. After querying element-ui, I found that thedestroy-on-close
method cannot be used. Clear data etc.
solve
Use the method on the tagel-dialog
to clear the form data and validation rules@close
In@close
method, use the following two methods to clear the data and verification rules
if (this.$refs['testForm'] !== undefined) {
this.$refs['testForm'].resetFields();
this.$refs['testForm'].clearValidate();
}
如若需要清空表单数据,test组件传入的表单数据form都需要监听并用另一个变量info接收并进行深拷贝,内外数据才不会相互影响