很多需求会重置表单,刚开始使用的方法就是一个个进行置空
// 新建家长
createParents() {
this.dialogVisible = true;
this.addOrRevise = 1;
this.titleName = "新建家长";
this.createParentsInfo = {
mobile: "",
remark: "",
students: [
{
isPrimaryContact: true,
relationshipId: "",
userId: "",
userName: "",
studentsList: [],
name: "",
eeid: "",
isStudentsShow: false
}
],
userName: "",
userId: "",
userStatus: "INACTIVE"
}
},
后来看同事的代码发现,还有这样简单的操作:
this.createParentsInfo = this.$options.data.call(this).createParentsInfo