2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-04 06:32:23 +03:00

Merge pull request #420 from sagalbot/feature/customize-tags

Custom Label Slot
This commit is contained in:
Jeff
2018-01-15 20:06:12 -08:00
committed by GitHub
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -47,6 +47,19 @@
{{option.label}} ({{option.value}})
</template>
</v-select>
<v-select multiple placeholder="custom label template" :options="options">
<span
slot="selected-option-container"
slot-scope="props"
class="selected-tag"
>
{{ props.option.label }} ({{ props.option.value }})
<button v-if="props.multiple" @click="props.deselect(props.option)" type="button" class="close" aria-label="Remove option">
<span aria-hidden="true">&times;</span>
</button>
</span>
</v-select>
<v-select placeholder="disabled" disabled value="disabled"></v-select>
<v-select placeholder="disabled multiple" disabled multiple :value="['disabled', 'multiple']"></v-select>
<v-select placeholder="filterable=false, @search=searchPeople" label="first_name" :filterable="false" @search="searchPeople" :options="people"></v-select>
+1 -1
View File
@@ -313,7 +313,7 @@
<div ref="toggle" @mousedown.prevent="toggleDropdown" :class="['dropdown-toggle', 'clearfix']">
<slot v-for="option in valueAsArray" name="selected-option-container"
:option="option" :deselect="deselect">
:option="option" :deselect="deselect" :multiple="multiple" :disabled="disabled">
<span class="selected-tag" v-bind:key="option.index">
<slot name="selected-option" v-bind="option">
{{ getOptionLabel(option) }}