Commit 4992d59c authored by cinwell.li's avatar cinwell.li Committed by FuryBean

Form: fix reset value, fixed #937 (#1021)

parent bcbee7b4
......@@ -78,8 +78,7 @@
validateDisabled: false,
validating: false,
validator: {},
isRequired: false,
initialValue: null
isRequired: false
};
},
methods: {
......@@ -148,21 +147,15 @@
}
this.validate('change');
},
getInitialValue() {
var value = this.form.model[this.prop];
if (value === undefined) {
return value;
} else {
return JSON.parse(JSON.stringify(value));
}
}
},
mounted() {
if (this.prop) {
this.dispatch('form', 'el.form.addField', [this]);
this.initialValue = this.getInitialValue();
Object.defineProperty(this, 'initialValue', {
value: this.form.model[this.prop]
});
let rules = this.getRules();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment