Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Enable the content switcher to work with `v-model` (#688)
Dhruv Bhanushali5b94c905ba7a
diff --git a/src/components/VContentSwitcher/VContentSwitcherButton.vue b/src/components/VContentSwitcher/VContentSwitcherButton.vueindex 3be5a3ec9..77812087b 100644--- a/src/components/VContentSwitcher/VContentSwitcherButton.vue+++ b/src/components/VContentSwitcher/VContentSwitcherButton.vue@@ -9,7 +9,7 @@@click="$emit('click')"><VIcon :icon-path="icon" />- <span v-show="showLabel" :class="{ 'ms-2': showLabel }">{{+ <span v-show="showLabel" :class="{ 'ms-2 w-20 text-left': showLabel }">{{buttonLabel}}</span><VIcondiff --git a/src/components/VContentSwitcher/VContentSwitcherPopover.vue b/src/components/VContentSwitcher/VContentSwitcherPopover.vueindex 96ab36847..d9a318851 100644--- a/src/components/VContentSwitcher/VContentSwitcherPopover.vue+++ b/src/components/VContentSwitcher/VContentSwitcherPopover.vue@@ -34,6 +34,10 @@ export default {VPopover,VContentTypes,},+ model: {+ prop: 'activeItem',+ event: 'select',+ },props: {activeItem: {type: String,diff --git a/src/components/VContentSwitcher/meta/VContentSwitcherPopover.stories.mdx b/src/components/VContentSwitcher/meta/VContentSwitcherPopover.stories.mdxindex e55be7a28..758933210 100644--- a/src/components/VContentSwitcher/meta/VContentSwitcherPopover.stories.mdx+++ b/src/components/VContentSwitcher/meta/VContentSwitcherPopover.stories.mdx@@ -6,6 +6,8 @@ import {Story,} from '@storybook/addon-docs'+import { ref } from '@nuxtjs/composition-api'+import VContentSwitcherPopover from '@/components/VContentSwitcher/VContentSwitcherPopover.vue'<Meta@@ -35,3 +37,27 @@ export const Template = (args, { argTypes }) => ({{Template.bind({})}</Story></Canvas>++## v-model++The recommended way to use it is with `v-model` mapping to a `String`.++export const vModelTemplate = () => ({+ template: `+ <div>+ {{ item }}+ <VContentSwitcherPopover v-model="item"/>+ </div>+ `,+ components: { VContentSwitcherPopover },+ setup() {+ const item = ref('all')+ return { item }+ },+})++<Canvas>+ <Story height="480px" name="v-model">+ {vModelTemplate.bind({})}+ </Story>+</Canvas>