sort InputCombo dropdown option by label
This commit is contained in:
parent
d9b598d078
commit
58ee59ddbc
1 changed files with 4 additions and 3 deletions
|
@ -10,8 +10,8 @@
|
||||||
>Search</button>
|
>Search</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a
|
<a
|
||||||
v-for="option in options"
|
v-for="(option, index) in sortedOptions"
|
||||||
:key="option[uniqueKey]"
|
:key="index"
|
||||||
class="dropdown-item"
|
class="dropdown-item"
|
||||||
@click="setInternalValue(option)"
|
@click="setInternalValue(option)"
|
||||||
:class="{ active: option == selectedOption }"
|
:class="{ active: option == selectedOption }"
|
||||||
|
@ -49,7 +49,8 @@ export default {
|
||||||
addingOption: false
|
addingOption: false
|
||||||
}),
|
}),
|
||||||
computed: {
|
computed: {
|
||||||
isValid: ({options, nameKey, internalName}) => options.some(e => e[nameKey] == internalName)
|
isValid: ({options, nameKey, internalName}) => options.some(e => e[nameKey] == internalName),
|
||||||
|
sortedOptions: ({options, nameKey}) => options.sort((a, b) => a[nameKey] > b[nameKey]),
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
internalName(newValue, oldValue) {
|
internalName(newValue, oldValue) {
|
||||||
|
|
Loading…
Reference in a new issue