feat: add SPK share link support and optimize category count calculation

- add SPK share button in app detail pages and support parsing SPK links in search box
- fix category total count to exclude the all entry
- remove redundant count badge from sidebar tabs
- rewrite category count calculation with proper filtering of all entry
- update search category count logic to use base apps for all tab count
This commit is contained in:
2026-07-14 13:39:20 +08:00
parent b233fea4d5
commit 750e1d89e4
6 changed files with 101 additions and 9 deletions
+25 -1
View File
@@ -58,6 +58,7 @@
@open-install-settings="handleOpenInstallSettings"
@open-about="openAboutModal"
@toggle-sidebar="isSidebarOpen = !isSidebarOpen"
@spk-link="handleSpkLink"
/>
</div>
<CategoryBar
@@ -586,7 +587,17 @@ const categoryCounts = computed(() => {
const sourceApps = displayApps.value;
if (searchQuery.value.trim()) {
return countSearchMatchesByCategory(sourceApps, searchQuery.value);
// all 统计所有应用中的搜索匹配数(不随 tab 变化)
const allCounts = countSearchMatchesByCategory(
baseApps.value,
searchQuery.value,
);
// 各分类统计当前 tab 中的搜索匹配数
const tabCounts = countSearchMatchesByCategory(
sourceApps,
searchQuery.value,
);
return { ...tabCounts, all: allCounts.all };
}
const counts: Record<string, number> = { all: apps.value.length };
@@ -2694,6 +2705,19 @@ const handleSearchInput = (value: string) => {
searchQuery.value = value;
};
const handleSpkLink = (pkgname: string) => {
currentView.value = "default";
activeTab.value = "all";
// 尝试从已加载的应用中查找
const target = apps.value.find((a) => a.pkgname === pkgname);
if (target) {
openDetail({ ...target, _fromDeepLink: true });
} else {
// 找不到时回退到搜索
searchQuery.value = pkgname;
}
};
const handleSearchFocus = () => {
currentView.value = "default";
if (activeTab.value === "home") activeTab.value = "all";