Commit 73b01ee06bcd37925e0379ba5a602b94abcbfbcd

Authored by ้ƒ‘ๆ•
1 parent 9ccd8196

fixed #3722 that check expected value status

Showing 1 changed file with 7 additions and 6 deletions   Show diff stats
src/components/select/select.vue
@@ -230,9 +230,7 @@ @@ -230,9 +230,7 @@
230 }).filter(Boolean); 230 }).filter(Boolean);
231 } 231 }
232 232
233 - if (this.getInitialValue().length > 0 && this.selectOptions.length === 0){  
234 - this.hasExpectedValue = true;  
235 - } 233 + this.checkUpdateStatus();
236 }, 234 },
237 data () { 235 data () {
238 236
@@ -632,15 +630,18 @@ @@ -632,15 +630,18 @@
632 }, 630 },
633 updateSlotOptions(){ 631 updateSlotOptions(){
634 this.slotOptions = this.$slots.default; 632 this.slotOptions = this.$slots.default;
  633 + },
  634 + checkUpdateStatus() {
  635 + if (this.getInitialValue().length > 0 && this.selectOptions.length === 0) {
  636 + this.hasExpectedValue = true;
  637 + }
635 } 638 }
636 }, 639 },
637 watch: { 640 watch: {
638 value(value){ 641 value(value){
639 const {getInitialValue, getOptionData, publicValue} = this; 642 const {getInitialValue, getOptionData, publicValue} = this;
640 643
641 - if (getInitialValue().length > 0) {  
642 - this.hasExpectedValue = true  
643 - } 644 + this.checkUpdateStatus();
644 645
645 if (value === '') this.values = []; 646 if (value === '') this.values = [];
646 else if (JSON.stringify(value) !== JSON.stringify(publicValue)) { 647 else if (JSON.stringify(value) !== JSON.stringify(publicValue)) {