mirror of https://github.com/ElemeFE/element
parent
bcbee7b472
commit
4992d59cdd
|
@ -78,8 +78,7 @@
|
||||||
validateDisabled: false,
|
validateDisabled: false,
|
||||||
validating: false,
|
validating: false,
|
||||||
validator: {},
|
validator: {},
|
||||||
isRequired: false,
|
isRequired: false
|
||||||
initialValue: null
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -148,21 +147,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.validate('change');
|
this.validate('change');
|
||||||
},
|
|
||||||
getInitialValue() {
|
|
||||||
var value = this.form.model[this.prop];
|
|
||||||
if (value === undefined) {
|
|
||||||
return value;
|
|
||||||
} else {
|
|
||||||
return JSON.parse(JSON.stringify(value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.prop) {
|
if (this.prop) {
|
||||||
this.dispatch('form', 'el.form.addField', [this]);
|
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();
|
let rules = this.getRules();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue