2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

overhaul option slot

This commit is contained in:
Jeff
2019-10-30 18:08:09 -07:00
parent 642e61c48e
commit 7f069a1c26
+3 -7
View File
@@ -52,12 +52,8 @@
<transition :name="transition"> <transition :name="transition">
<ul ref="dropdownMenu" v-if="dropdownOpen" class="vs__dropdown-menu" role="listbox" @mousedown.prevent="onMousedown" @mouseup="onMouseUp"> <ul ref="dropdownMenu" v-if="dropdownOpen" class="vs__dropdown-menu" role="listbox" @mousedown.prevent="onMousedown" @mouseup="onMouseUp">
<slot name="option" v-for="(option, index) in normalizedFilteredOptions"> <slot name="option" v-for="scope in normalizedFilteredOptions" v-bind="scope">
<li <li v-bind="scope.attributes" v-on="scope.events">{{ getOptionLabel(scope.option) }}</li>
role="option"
v-bind="getDropdownOptionScope(option, index).attributes"
v-on="getDropdownOptionScope(option, index).events"
>{{ getOptionLabel(option) }}</li>
</slot> </slot>
<li v-if="!filteredOptions.length" class="vs__no-options" @mousedown.stop=""> <li v-if="!filteredOptions.length" class="vs__no-options" @mousedown.stop="">
<slot name="no-options">Sorry, no matching options.</slot> <slot name="no-options">Sorry, no matching options.</slot>
@@ -1073,7 +1069,7 @@
}, },
normalizedFilteredOptions() { normalizedFilteredOptions() {
return this.filteredOptions.map(option => this.normalizeOptionForSlot(option)); return this.filteredOptions.map((option, index) => this.getDropdownOptionScope(this.normalizeOptionForSlot(option), index));
}, },
/** /**