this.$refs['activityForm'].resetFields();
只会重置之前表单的内容,并不会清空
只需在关闭弹框的cancel方法中写上重置表单的方法即可
cancel() { this.$refs.formData.resetFields(); }
若首先编辑,会初始化值,再新增resetFields无效,需做如下处理:
modifyDeptDialog () {
let selectRow = this.$refs.table.store.states.currentRow
this.dialogVisible = true
//回显数据
setTimeout(function () {
this.saveDeptForm = deepClone(selectRow)
}.bind(this), 0);
},
或者
modifyDeptDialog () {
let selectRow = this.$refs.table.store.states.currentRow
this.dialogVisible = true //回显数据 this.$nextTick(()=>{ this.saveDeptForm = deepClone(selectRow) }) },