Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 10x 16x 16x 8x 8x | <script> import { GlCollapsibleListbox } from '@gitlab/ui'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; export default { name: 'PersistedDropdownSelection', components: { GlCollapsibleListbox, LocalStorageSync, }, props: { options: { type: Array, required: true, }, storageKey: { type: String, required: true, }, }, data() { return { selected: this.options[0].value, }; }, computed: { listboxItems() { return this.options.map((option) => ({ value: option.value, text: option.label, })); }, }, methods: { setSelected(value) { this.selected = value; this.$emit('change', value); }, }, }; </script> <template> <local-storage-sync :storage-key="storageKey" :value="selected" as-string @input="setSelected"> <gl-collapsible-listbox v-model="selected" :items="listboxItems" @select="setSelected" /> </local-storage-sync> </template> |