Skip to content

Commit

Permalink
Form: fix reset value, fixed ElemeFE#937
Browse files Browse the repository at this point in the history
  • Loading branch information
QingWei-Li committed Nov 13, 2016
1 parent 58dc7e1 commit aeb68b0
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions packages/form/src/form-item.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@
validateDisabled: false,
validating: false,
validator: {},
isRequired: false,
initialValue: null
isRequired: false
};
},
methods: {
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit aeb68b0

Please sign in to comment.