Skip to content

Commit 5271ed7

Browse files
committed
Added features to non multiple selects
- added a single class to the selected-tag for non multiple selects - added styling to the single selected-tag to differentiate it from the default
1 parent 90981a5 commit 5271ed7

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/components/Select.vue

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,14 @@
115115
float: left;
116116
line-height: 24px;
117117
}
118+
.v-select .selected-tag.single {
119+
background-color: transparent;
120+
border-color: transparent;
121+
}
122+
.v-select.open .selected-tag.single {
123+
position: absolute;
124+
opacity: 0.5;
125+
}
118126
.v-select .selected-tag .close {
119127
float: none;
120128
margin-right: 0;
@@ -254,7 +262,7 @@
254262
<div class="dropdown v-select" :class="dropdownClasses">
255263
<div ref="toggle" @mousedown.prevent="toggleDropdown" class="dropdown-toggle">
256264

257-
<span class="selected-tag" v-for="option in valueAsArray" v-bind:key="option.index">
265+
<span class="selected-tag" :class="selectedTagClasses" v-for="option in valueAsArray" v-bind:key="option.index">
258266
{{ getOptionLabel(option) }}
259267
<button v-if="multiple" @click="deselect(option)" type="button" class="close">
260268
<span aria-hidden="true">&times;</span>
@@ -769,6 +777,16 @@
769777
}
770778
},
771779
780+
/**
781+
* Classes to be output on .selected-tag
782+
* @return {Object}
783+
*/
784+
selectedTagClasses() {
785+
return {
786+
single: !this.multiple
787+
}
788+
},
789+
772790
/**
773791
* Return the current state of the
774792
* dropdown menu.

0 commit comments

Comments
 (0)