diff --git a/src/pages/subscribe.vue b/src/pages/subscribe.vue index 038fb520..13c83e2f 100644 --- a/src/pages/subscribe.vue +++ b/src/pages/subscribe.vue @@ -82,14 +82,25 @@ const filterOptions = computed(() => { ] }) -// 计算筛选按钮颜色 +// 当前选中的筛选选项 +const currentFilter = computed(() => { + return filterOptions.value.find(option => option.value === (subscribeStatusFilter.value || 'all')) +}) + +// 计算筛选按钮颜色 - 有名称筛选或状态筛选时高亮 const filterButtonColor = computed(() => { if (subscribeFilter.value || (subscribeStatusFilter.value && subscribeStatusFilter.value !== 'all')) { - return 'primary' + return currentFilter.value?.color || 'primary' } return 'gray' }) +// 选择筛选选项 +function selectFilter(value: string) { + subscribeStatusFilter.value = value + filterSubscribeDialog.value = false +} + // VMenu activator选择器 const filterActivator = computed(() => '[data-menu-activator="filter-btn"]') const searchActivator = computed(() => '[data-menu-activator="search-btn"]') @@ -200,44 +211,47 @@ onMounted(() => { - + - - - - - {{ t('subscribe.filterSubscriptions') }} - - - - - - - - - - - - - - - - + + +
+ +
+ + + + {{ t('common.status') }} + + + {{ option.label }} + + +
diff --git a/src/views/plugin/PluginCardListView.vue b/src/views/plugin/PluginCardListView.vue index 20726059..977d06a7 100644 --- a/src/views/plugin/PluginCardListView.vue +++ b/src/views/plugin/PluginCardListView.vue @@ -219,6 +219,16 @@ const isFilterFormEmpty = computed(() => { ) }) +// 切换市场过滤器多选项 +function toggleMarketFilter(field: 'author' | 'label' | 'repo', value: string) { + const index = filterForm[field].indexOf(value) + if (index > -1) { + filterForm[field].splice(index, 1) + } else { + filterForm[field].push(value) + } +} + // 插件过滤条件 const installedFilter = ref(null) @@ -1289,113 +1299,159 @@ function onDragStartPlugin(evt: any) {