Skip to content

Commit

Permalink
fix Select bug that multiple options disalbed
Browse files Browse the repository at this point in the history
  • Loading branch information
icarusion committed Jul 3, 2020
1 parent df671ae commit b15d945
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/select/select-head.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
class="ivu-tag ivu-tag-checked"
v-for="(item, index) in selectedMultiple"
v-if="maxTagCount === undefined || index < maxTagCount">
<span class="ivu-tag-text">{{ item.tag !== undefined ? item.tag : item.label }}</span>
<Icon type="ios-close" @click.native.stop="removeTag(item)"></Icon>
<span class="ivu-tag-text" :class="{ 'ivu-select-multiple-tag-hidden': item.disabled }">{{ item.tag !== undefined ? item.tag : item.label }}</span>
<Icon type="ios-close" v-if="!item.disabled" @click.native.stop="removeTag(item)"></Icon>
</div><div class="ivu-tag ivu-tag-checked" v-if="maxTagCount !== undefined && selectedMultiple.length > maxTagCount">
<span class="ivu-tag-text ivu-select-max-tag">
<template v-if="maxTagPlaceholder">{{ maxTagPlaceholder(selectedMultiple.length - maxTagCount) }}</template>
Expand Down
3 changes: 3 additions & 0 deletions src/components/select/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down
12 changes: 12 additions & 0 deletions src/styles/components/select.less
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@
top: 4px;
}
}
&-multiple-tag-hidden{
margin-right: 0 !important;
}

&-large&-multiple .@{css-prefix}tag{
height: 32px;
Expand Down Expand Up @@ -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} {
Expand Down

0 comments on commit b15d945

Please sign in to comment.