diff --git a/src/App.vue b/src/App.vue index dc94086e..0c4acf1c 100644 --- a/src/App.vue +++ b/src/App.vue @@ -303,6 +303,30 @@ const filteredApps = computed(() => { }); const categoryCounts = computed(() => { + // 如果有搜索关键词,显示搜索结果数量 + if (searchQuery.value.trim()) { + const q = searchQuery.value.toLowerCase().trim(); + const counts: Record = { all: 0 }; + + apps.value.forEach((app) => { + // 检查应用是否匹配搜索条件 + const matches = + (app.name || "").toLowerCase().includes(q) || + (app.pkgname || "").toLowerCase().includes(q) || + (app.tags || "").toLowerCase().includes(q) || + (app.more || "").toLowerCase().includes(q); + + if (matches) { + counts.all++; + if (!counts[app.category]) counts[app.category] = 0; + counts[app.category]++; + } + }); + + return counts; + } + + // 无搜索时显示总数量 const counts: Record = { all: apps.value.length }; apps.value.forEach((app) => { if (!counts[app.category]) counts[app.category] = 0; diff --git a/src/components/AppCard.vue b/src/components/AppCard.vue index 9dac369f..b76297be 100644 --- a/src/components/AppCard.vue +++ b/src/components/AppCard.vue @@ -1,19 +1,17 @@