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

pull/1008/head
cinwell.li 2016-11-13 11:51:57 +08:00 committed by FuryBean
parent bcbee7b472
commit 4992d59cdd
1 changed files with 4 additions and 11 deletions

View File

@ -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();