File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 47
47
{{option.label}} ({{option.value}})
48
48
</ template >
49
49
</ v-select >
50
+ < v-select placeholder ="custom option template for string array " taggable :options ="['cat', 'dog', 'bear'] " multiple >
51
+ < template slot ="selected-option " slot-scope ="option ">
52
+ {{option.label}}
53
+ </ template >
54
+ < template slot ="option " slot-scope ="option ">
55
+ {{option.label}}
56
+ </ template >
57
+ </ v-select >
50
58
< v-select multiple placeholder ="custom label template " :options ="options ">
51
59
< span
52
60
slot ="selected-option-container "
Original file line number Diff line number Diff line change 313
313
<div ref =" toggle" @mousedown.prevent =" toggleDropdown" :class =" ['dropdown-toggle', 'clearfix']" >
314
314
315
315
<slot v-for =" option in valueAsArray" name =" selected-option-container"
316
- :option =" option" :deselect =" deselect" :multiple =" multiple" :disabled =" disabled" >
316
+ :option =" (typeof option === 'object')?option:{[label]: option} " :deselect =" deselect" :multiple =" multiple" :disabled =" disabled" >
317
317
<span class =" selected-tag" v-bind:key =" option.index" >
318
- <slot name =" selected-option" v-bind =" option" >
318
+ <slot name =" selected-option" v-bind =" (typeof option === 'object')?option:{[label]: option} " >
319
319
{{ getOptionLabel(option) }}
320
320
</slot >
321
321
<button v-if =" multiple" :disabled =" disabled" @click =" deselect(option)" type =" button" class =" close" aria-label =" Remove option" >
368
368
<ul ref =" dropdownMenu" v-if =" dropdownOpen" class =" dropdown-menu" :style =" { 'max-height': maxHeight }" >
369
369
<li v-for =" (option, index) in filteredOptions" v-bind:key =" index" :class =" { active: isOptionSelected(option), highlight: index === typeAheadPointer }" @mouseover =" typeAheadPointer = index" >
370
370
<a @mousedown.prevent =" select(option)" >
371
- <slot name =" option" v-bind =" option" >
371
+ <slot name =" option" v-bind =" (typeof option === 'object')?option:{[label]: option} " >
372
372
{{ getOptionLabel(option) }}
373
373
</slot >
374
374
</a >
You can’t perform that action at this time.
0 commit comments