fixed #3722 that check expected value status

This commit is contained in:
郑敏 2018-06-05 14:32:19 +08:00
parent 9ccd81961b
commit 73b01ee06b

View file

@ -230,9 +230,7 @@
}).filter(Boolean); }).filter(Boolean);
} }
if (this.getInitialValue().length > 0 && this.selectOptions.length === 0){ this.checkUpdateStatus();
this.hasExpectedValue = true;
}
}, },
data () { data () {
@ -632,15 +630,18 @@
}, },
updateSlotOptions(){ updateSlotOptions(){
this.slotOptions = this.$slots.default; this.slotOptions = this.$slots.default;
},
checkUpdateStatus() {
if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) {
this.hasExpectedValue = true;
}
} }
}, },
watch: { watch: {
value(value){ value(value){
const {getInitialValue, getOptionData, publicValue} = this; const {getInitialValue, getOptionData, publicValue} = this;
if (getInitialValue().length > 0) { this.checkUpdateStatus();
this.hasExpectedValue = true
}
if (value === '') this.values = []; if (value === '') this.values = [];
else if (JSON.stringify(value) !== JSON.stringify(publicValue)) { else if (JSON.stringify(value) !== JSON.stringify(publicValue)) {