mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
be44b29ce2
Resolves #1071, Resolves #1081 https://vue-select.org/guide/slots.html#improving-the-default-no-options-text
2.5 KiB
2.5 KiB
::: tip Vue Select leverages scoped slots to allow for total customization of the presentation layer. Slots can be used to change the look and feel of the UI, or to simply swap out text. :::
Selected Option(s)
selected-option
Scope:
option {Object}- A selected option
<slot
name="selected-option"
v-bind="(typeof option === 'object')?option:{[label]: option}"
>
{{ getOptionLabel(option) }}
</slot>
selected-option-container
Scope:
option {Object}- A selected optiondeselect {Function}- Method used to deselect a given option whenmultipleis truedisabled {Boolean}- Determine if the component is disabledmultiple {Boolean}- If the component supports the selection of multiple values
<slot
v-for="option in valueAsArray"
name="selected-option-container"
:option="(typeof option === 'object')?option:{[label]: option}"
:deselect="deselect"
:multiple="multiple"
:disabled="disabled"
>
<span class="selected-tag" v-bind:key="option.index">
<slot
name="selected-option"
v-bind="(typeof option === 'object')?option:{[label]: option}"
>
{{ getOptionLabel(option) }}
</slot>
<button
v-if="multiple"
:disabled="disabled"
@click="deselect(option)"
type="button"
class="close"
aria-label="Remove option"
>
<span aria-hidden="true">×</span>
</button>
</span>
</slot>
Component Actions
spinner
Scope:
loading {Boolean}- if the component is in a loading state
<slot name="spinner" v-bind="scope.spinner">
<div class="vs__spinner" v-show="mutableLoading">Loading...</div>
</slot>
open-indicator
attributes : {
'ref': 'openIndicator',
'role': 'presentation',
'class': 'vs__open-indicator',
}
<slot name="open-indicator" v-bind="scope.openIndicator">
<component :is="childComponents.OpenIndicator" v-if="!noDrop" v-bind="scope.openIndicator.attributes"/>
</slot>
Dropdown
option
option {Object}- The currently iterated option fromfilteredOptions
<slot
name="option"
v-bind="(typeof option === 'object')?option:{[label]: option}"
>
{{ getOptionLabel(option) }}
</slot>
no-options
The no options slot is displayed in the dropdown when filteredOptions.length === 0.
search {String}- the current search textsearching {Boolean}- if the component has search text
<slot name="no-options" v-bind="scope.noOptions">
Sorry, no matching options.
</slot>