DatePicker: improve form change validation (#12348)

watch.value will keep firing during time picker selection
it now detects whether panel is closed before firing el.form.change
pull/12356/merge
Jiewei Qian 2018-08-15 13:38:37 +10:00 committed by Jikkai Xiao
parent 02176e26f4
commit b70da53f15
1 changed files with 2 additions and 1 deletions

View File

@ -429,7 +429,7 @@ export default {
} }
}, },
value(val, oldVal) { value(val, oldVal) {
if (!valueEquals(val, oldVal)) { if (!valueEquals(val, oldVal) && !this.pickerVisible) {
this.dispatch('ElFormItem', 'el.form.change', val); this.dispatch('ElFormItem', 'el.form.change', val);
} }
} }
@ -893,6 +893,7 @@ export default {
// determine user real change only // determine user real change only
if (!valueEquals(val, this.valueOnOpen)) { if (!valueEquals(val, this.valueOnOpen)) {
this.$emit('change', val); this.$emit('change', val);
this.dispatch('ElFormItem', 'el.form.change', val);
this.valueOnOpen = val; this.valueOnOpen = val;
} }
}, },