diff options
Diffstat (limited to 'src/components/Settings/SettingsSortContacts.vue')
-rw-r--r-- | src/components/Settings/SettingsSortContacts.vue | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/components/Settings/SettingsSortContacts.vue b/src/components/Settings/SettingsSortContacts.vue index 6e13f575..d6cb83c5 100644 --- a/src/components/Settings/SettingsSortContacts.vue +++ b/src/components/Settings/SettingsSortContacts.vue @@ -22,13 +22,13 @@ <template> <div class="sort-contacts"> - <label for="sort-by">{{ t('contacts', 'Sort by:') }}</label> <multiselect id="sort-by" - :placeholder="orderKey" + :value="orderKeyOption" :searchable="false" :allow-empty="false" :options="options" + :custom-label="formatSortByLabel" track-by="key" label="label" @input="sortContacts" /> @@ -40,15 +40,6 @@ export default { name: 'SettingsSortContacts', - props: { - addressbook: { - type: Object, - default() { - return {} - } - } - }, - computed: { /* Order Keys */ options() { @@ -69,7 +60,10 @@ export default { }, /* Current order Key */ orderKey() { - return t('contacts', this.options.filter(f => f.key === this.$store.getters.getOrderKey)[0].label) + return this.$store.getters.getOrderKey + }, + orderKeyOption() { + return this.options.filter(option => option.key === this.orderKey)[0] } }, methods: { @@ -78,6 +72,9 @@ export default { this.$store.commit('setOrder', key) this.$store.commit('sortContacts') localStorage.setItem('orderKey', key) + }, + formatSortByLabel(option) { + return t('contacts', 'Sort by {sorting}', { sorting: option.label }) } } } |