From d6b7b6d813b29de8d199674fb8b810784ab5ff13 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 1 Jun 2026 21:32:04 +0800 Subject: [PATCH] fix: close plugin filter menus after selection --- src/views/plugin/PluginCardListView.vue | 48 +++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/src/views/plugin/PluginCardListView.vue b/src/views/plugin/PluginCardListView.vue index 00add930..114d365c 100644 --- a/src/views/plugin/PluginCardListView.vue +++ b/src/views/plugin/PluginCardListView.vue @@ -222,6 +222,23 @@ function toggleMarketFilter(field: 'author' | 'label' | 'repo', value: string) { } } +// 关闭插件市场过滤菜单。 +function closeMarketFilterMenu() { + filterMarketPluginDialog.value = false +} + +// 选择插件市场排序项并关闭过滤菜单。 +function selectMarketSort(value: string) { + activeSort.value = value + closeMarketFilterMenu() +} + +// 提交插件市场关键字过滤并关闭过滤菜单。 +function submitMarketNameFilter(event: KeyboardEvent) { + if (event.isComposing) return + closeMarketFilterMenu() +} + // 插件过滤条件 const installedFilter = ref(null) @@ -237,6 +254,29 @@ const filterInstalledPluginDialog = ref(false) // 插件市场过滤窗口 const filterMarketPluginDialog = ref(false) +// 关闭已安装插件过滤菜单。 +function closeInstalledFilterMenu() { + filterInstalledPluginDialog.value = false +} + +// 切换已启用插件过滤条件并关闭过滤菜单。 +function toggleEnabledInstalledFilter() { + enabledFilter.value = !enabledFilter.value + closeInstalledFilterMenu() +} + +// 切换有新版本插件过滤条件并关闭过滤菜单。 +function toggleHasUpdateInstalledFilter() { + hasUpdateFilter.value = !hasUpdateFilter.value + closeInstalledFilterMenu() +} + +// 提交已安装插件关键字过滤并关闭过滤菜单。 +function submitInstalledNameFilter(event: KeyboardEvent) { + if (event.isComposing) return + closeInstalledFilterMenu() +} + // 作者过滤项 const authorFilterOptions = ref([]) // 标签过滤项 @@ -1480,13 +1520,14 @@ function onDragStartPlugin(evt: any) { variant="outlined" hide-details clearable + @keyup.enter="submitInstalledNameFilter" /> {{ t('common.filter') }} - + @@ -1495,7 +1536,7 @@ function onDragStartPlugin(evt: any) { - + @@ -1528,6 +1569,7 @@ function onDragStartPlugin(evt: any) { variant="outlined" hide-details clearable + @keyup.enter="submitMarketNameFilter" /> @@ -1538,7 +1580,7 @@ function onDragStartPlugin(evt: any) { v-for="option in sortOptions" :key="option.value" :active="(activeSort || 'count') === option.value" - @click="activeSort = option.value" + @click="selectMarketSort(option.value)" density="compact" > {{ option.title }}