Commit 73b01ee06bcd37925e0379ba5a602b94abcbfbcd
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 | 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 | 235 | data () { |
| 238 | 236 | |
| ... | ... | @@ -632,15 +630,18 @@ |
| 632 | 630 | }, |
| 633 | 631 | updateSlotOptions(){ |
| 634 | 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 | 640 | watch: { |
| 638 | 641 | value(value){ |
| 639 | 642 | const {getInitialValue, getOptionData, publicValue} = this; |
| 640 | 643 | |
| 641 | - if (getInitialValue().length > 0) { | |
| 642 | - this.hasExpectedValue = true | |
| 643 | - } | |
| 644 | + this.checkUpdateStatus(); | |
| 644 | 645 | |
| 645 | 646 | if (value === '') this.values = []; |
| 646 | 647 | else if (JSON.stringify(value) !== JSON.stringify(publicValue)) { | ... | ... |