22import { computed , ref } from ' vue'
33import { useI18n } from ' vue-i18n'
44
5+ import { useBool } from ' @/hooks'
56import { usePluginsStore } from ' @/stores'
67import { deepClone , message , sleep } from ' @/utils'
78
@@ -11,6 +12,7 @@ const keywords = ref('')
1112const { t } = useI18n ()
1213const pluginsStore = usePluginsStore ()
1314
15+ const [tagsVisible, toggleTagsVisible] = useBool (false )
1416const tags = ref <Set <string >>(new Set ())
1517
1618const allTags = computed (() => {
@@ -27,6 +29,10 @@ const allTags = computed(() => {
2729
2830const onTagClose = (tag : string ) => tags .value .delete (tag )
2931
32+ const toggleChecked = (tag : string ) => {
33+ tags .value .has (tag ) ? tags .value .delete (tag ) : tags .value .add (tag )
34+ }
35+
3036const filteredPlugins = computed (() => {
3137 const allPlugins = pluginsStore .pluginHub
3238 const keyword = keywords .value .trim ()
@@ -80,6 +86,12 @@ if (pluginsStore.pluginHub.length === 0) {
8086 </div >
8187 <div v-else class =" flex flex-col h-full" >
8288 <div class =" flex items-center gap-8" >
89+ <Button
90+ @click =" toggleTagsVisible"
91+ icon =" settings3"
92+ size =" small"
93+ :icon-color =" tagsVisible ? 'var(--primary-color)' : ''"
94+ />
8395 <Input
8496 v-model =" keywords"
8597 :border =" false"
@@ -106,10 +118,10 @@ if (pluginsStore.pluginHub.length === 0) {
106118 {{ t('plugins.update') }}
107119 </Button >
108120 </div >
109- <div class =" flex flex-wrap gap-2 mt-8" >
121+ <div v-if = " tagsVisible " class =" flex flex-wrap gap-2 mt-8" >
110122 <Tag
111123 v-for =" tag in allTags"
112- @click =" tags.add (tag.name)"
124+ @click =" toggleChecked (tag.name)"
113125 :color =" tags.has(tag.name) ? 'primary' : 'default'"
114126 :key =" tag.name"
115127 class =" cursor-pointer"
@@ -120,7 +132,7 @@ if (pluginsStore.pluginHub.length === 0) {
120132
121133 <Empty v-if =" filteredPlugins.length === 0" />
122134
123- <div class =" overflow-y-auto grid grid-cols-3 text-12 gap-8 mt-8" >
135+ <div class =" overflow-y-auto grid grid-cols-3 text-12 gap-8 mt-8 pb-16 pr-8 " >
124136 <Card v-for =" plugin in filteredPlugins" :key =" plugin.id" :title =" plugin.name" >
125137 <div class =" flex flex-col h-full" >
126138 <div v-tips =" plugin.description" class =" flex-1 line-clamp-2" >
0 commit comments