diff --git a/docs/components/AddonGallery.vue b/docs/components/AddonGallery.vue index 691d6f255e..e678f44ae6 100644 --- a/docs/components/AddonGallery.vue +++ b/docs/components/AddonGallery.vue @@ -5,6 +5,7 @@ import { useI18n } from 'vue-i18n' export interface ValaxyAddon { icon: string name: string + author: string | string[] repo: string desc: string desc_zh: string @@ -20,10 +21,19 @@ const props = withDefaults(defineProps<{ const { t } = useI18n() const keyword = ref('') const filteredAddons = computed(() => { - return props.addons.filter((item) => { - return item.name.includes(keyword.value) || item.tags?.some(t => t.includes(keyword.value)) - }) + return props.addons + .filter(item => item.name.includes(keyword.value) || item.tags?.some(t => t.includes(keyword.value))) + .map((item) => { + if (typeof item.author === 'string') + return { ...item, author: [item.author] } + + return item + }) }) + +function handleTagClick(tag: string) { + keyword.value = tag +} diff --git a/docs/components/AddonGalleryCard.vue b/docs/components/AddonGalleryCard.vue index d3f7122cb3..b352e6930a 100644 --- a/docs/components/AddonGalleryCard.vue +++ b/docs/components/AddonGalleryCard.vue @@ -4,6 +4,12 @@ import type { ValaxyAddon } from './AddonGallery.vue' defineProps<{ addon: ValaxyAddon }>() + +const emit = defineEmits(['tagClick']) + +function handleTagClick(tag: string) { + emit('tagClick', tag) +}