重置表单数据
- 笨方法
this.from = {
date: "",
sex: "",
age: ""
};
- 常用方法
resetForm(formName) {
this.$refs[formName].resetFields();
}
- 冷门写法
// 1
this.searchForm = JSON.parse(this._searchForm);
// 2
Object.assign(this.$data, this.$options.data()) // 全部重置
Object.assign(this.$data.form, this.$options.data().form) // 部分重置