From 07201151da318b83e5ddf65149643f84205b7488 Mon Sep 17 00:00:00 2001 From: 梁灏 Date: Thu, 27 Dec 2018 11:53:47 +0800 Subject: [PATCH] fix #5090 --- src/components/select/select.vue | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/components/select/select.vue b/src/components/select/select.vue index d1fe263..d446a8a 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -761,21 +761,12 @@ }, slotOptions(options, old){ // #4626,当 Options 的 label 更新时,v-model 的值未更新 - if (this.flatOptions && this.flatOptions.length && this.values.length && !this.multiple && !this.remote) { - this.values = this.values.map(value => { - const option = this.flatOptions.find(option => { - if (!option.componentOptions) return false; - return option.componentOptions.propsData.value === value.value; - }); - - if(!option) return null; - - const label = getOptionLabel(option); - return { - value: value.value, - label: label - }; - }).filter(Boolean); + // remote 下,调用 getInitialValue 有 bug + if (!this.remote) { + const values = this.getInitialValue(); + if (this.flatOptions && this.flatOptions.length && values.length && !this.multiple) { + this.values = values.map(this.getOptionData).filter(Boolean); + } } // 当 dropdown 在控件上部显示时,如果选项列表的长度由外部动态变更了, -- libgit2 0.21.4