From b15d9455cc1b41f4206f0e24b308ea79ff2a3728 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=81=8F?= Date: Fri, 3 Jul 2020 12:02:27 +0800 Subject: [PATCH] fix Select bug that multiple options disalbed --- src/components/select/select-head.vue | 4 ++-- src/components/select/select.vue | 3 +++ src/styles/components/select.less | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/components/select/select-head.vue b/src/components/select/select-head.vue index 12869f70e..e22385369 100644 --- a/src/components/select/select-head.vue +++ b/src/components/select/select-head.vue @@ -9,8 +9,8 @@ class="ivu-tag ivu-tag-checked" v-for="(item, index) in selectedMultiple" v-if="maxTagCount === undefined || index < maxTagCount"> - {{ item.tag !== undefined ? item.tag : item.label }} - + {{ item.tag !== undefined ? item.tag : item.label }} +
diff --git a/src/components/select/select.vue b/src/components/select/select.vue index f5896c66a..13a3b0914 100644 --- a/src/components/select/select.vue +++ b/src/components/select/select.vue @@ -490,9 +490,12 @@ const option = this.flatOptions.find(({componentOptions}) => componentOptions.propsData.value === value); if (!option) return null; const label = getOptionLabel(option); + // 修复多选时,选项有disabled属性,选中项仍然能删除的 bug + const disabled = option.componentOptions.propsData.disabled; return { value: value, label: label, + disabled: disabled }; }, getInitialValue(){ diff --git a/src/styles/components/select.less b/src/styles/components/select.less index b812d53bf..b586c2cbd 100644 --- a/src/styles/components/select.less +++ b/src/styles/components/select.less @@ -229,6 +229,9 @@ top: 4px; } } + &-multiple-tag-hidden{ + margin-right: 0 !important; + } &-large&-multiple .@{css-prefix}tag{ height: 32px; @@ -319,6 +322,15 @@ top: 2px; right: 8px; } + &-selected.ivu-select-item-disabled{ + color: @btn-disable-color; + &:after{ + color: @btn-disable-color; + } + &:hover{ + background-color: #fff; + } + } } .@{select-group-prefix-cls} {