mirror of https://github.com/ElemeFE/element
Select: use tags to show option when collapse-tags is set (#8567)
* modify set collapse-tags just show text * Update select.vuepull/8596/merge
parent
f01ebad0b1
commit
bd3ccaab3f
|
@ -9,12 +9,25 @@
|
||||||
@click.stop="toggleMenu"
|
@click.stop="toggleMenu"
|
||||||
ref="tags"
|
ref="tags"
|
||||||
:style="{ 'max-width': inputWidth - 32 + 'px' }">
|
:style="{ 'max-width': inputWidth - 32 + 'px' }">
|
||||||
<span
|
<div v-if="collapseTags && selected.length">
|
||||||
class="el-select__multiple-text"
|
<el-tag
|
||||||
v-show="multipleText"
|
:closable="!disabled"
|
||||||
v-if="collapseTags">
|
size="small"
|
||||||
{{ multipleText }}
|
:hit="selected[0].hitState"
|
||||||
</span>
|
type="info"
|
||||||
|
@close="deleteTag($event, selected[0])"
|
||||||
|
disable-transitions>
|
||||||
|
<span class="el-select__tags-text">{{ selected[0].currentLabel }}</span>
|
||||||
|
</el-tag>
|
||||||
|
<el-tag
|
||||||
|
v-if="selected.length > 1"
|
||||||
|
:closable="false"
|
||||||
|
size="small"
|
||||||
|
type="info"
|
||||||
|
disable-transitions>
|
||||||
|
<span class="el-select__tags-text">+ {{ selected.length - 1 }}</span>
|
||||||
|
</el-tag>
|
||||||
|
</div>
|
||||||
<transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
|
<transition-group @after-leave="resetInputHeight" v-if="!collapseTags">
|
||||||
<el-tag
|
<el-tag
|
||||||
v-for="item in selected"
|
v-for="item in selected"
|
||||||
|
@ -191,14 +204,6 @@
|
||||||
|
|
||||||
selectSize() {
|
selectSize() {
|
||||||
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
return this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
|
||||||
},
|
|
||||||
|
|
||||||
multipleText() {
|
|
||||||
const selected = this.selected;
|
|
||||||
if (!selected || !selected.length) return '';
|
|
||||||
const length = selected.length;
|
|
||||||
const countText = length > 1 ? `(+${ selected.length - 1 })` : '';
|
|
||||||
return `${ selected[0].currentLabel } ${ countText }`;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -89,14 +89,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@include e(multiple-text) {
|
|
||||||
margin-left: 15px;
|
|
||||||
color: $--input-color;
|
|
||||||
font-size: $--font-size-base;
|
|
||||||
display: inline;
|
|
||||||
@include utils-ellipsis;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include e(close) {
|
@include e(close) {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
Loading…
Reference in New Issue