Select: trigger validation after resetField (#10105)

pull/10106/head
杨奕 2018-03-10 20:20:48 +08:00 committed by GitHub
parent 9f47918477
commit f234b161df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -217,13 +217,16 @@
let prop = getPropByPath(model, path, true);
this.validateDisabled = true;
if (Array.isArray(value)) {
this.validateDisabled = true;
prop.o[prop.k] = [].concat(this.initialValue);
} else {
this.validateDisabled = true;
prop.o[prop.k] = this.initialValue;
}
/* Select
这里需要强行触发一次刷新 validateDisabled 的值
确保 Select 下一次值改变时能正确触发校验 */
this.broadcast('ElSelect', 'fieldReset');
},
getRules() {
let formRules = this.form.rules;

View File

@ -789,6 +789,9 @@
this.$on('handleOptionClick', this.handleOptionSelect);
this.$on('setSelected', this.setSelected);
this.$on('fieldReset', () => {
this.dispatch('ElFormItem', 'el.form.change');
});
},
mounted() {