Commit 07201151da318b83e5ddf65149643f84205b7488
1 parent
abb82deb
fix #5090
Showing
1 changed file
with
6 additions
and
15 deletions
Show diff stats
src/components/select/select.vue
| ... | ... | @@ -761,21 +761,12 @@ |
| 761 | 761 | }, |
| 762 | 762 | slotOptions(options, old){ |
| 763 | 763 | // #4626,当 Options 的 label 更新时,v-model 的值未更新 |
| 764 | - if (this.flatOptions && this.flatOptions.length && this.values.length && !this.multiple && !this.remote) { | |
| 765 | - this.values = this.values.map(value => { | |
| 766 | - const option = this.flatOptions.find(option => { | |
| 767 | - if (!option.componentOptions) return false; | |
| 768 | - return option.componentOptions.propsData.value === value.value; | |
| 769 | - }); | |
| 770 | - | |
| 771 | - if(!option) return null; | |
| 772 | - | |
| 773 | - const label = getOptionLabel(option); | |
| 774 | - return { | |
| 775 | - value: value.value, | |
| 776 | - label: label | |
| 777 | - }; | |
| 778 | - }).filter(Boolean); | |
| 764 | + // remote 下,调用 getInitialValue 有 bug | |
| 765 | + if (!this.remote) { | |
| 766 | + const values = this.getInitialValue(); | |
| 767 | + if (this.flatOptions && this.flatOptions.length && values.length && !this.multiple) { | |
| 768 | + this.values = values.map(this.getOptionData).filter(Boolean); | |
| 769 | + } | |
| 779 | 770 | } |
| 780 | 771 | |
| 781 | 772 | // 当 dropdown 在控件上部显示时,如果选项列表的长度由外部动态变更了, | ... | ... |