feat: 首页跳转到分类页指定分类优化

This commit is contained in:
R524809
2026-05-09 11:08:29 +08:00
parent c21ac9e935
commit debecd67c6
20 changed files with 1450 additions and 959 deletions
+25
View File
@@ -75,3 +75,28 @@ export function parseMiniProgramUrl(input: string) {
return { path: pathPart, query };
}
/** tabBar 无法用 switchTab 带 query:用 globalData 传一次性意图,避免 storage 磁盘同步读写 */
export function stashPendingCategoryTabId(id: string) {
const trimmed = String(id ?? '').trim();
if (!trimmed) return;
try {
getApp<IAppOption>().globalData.pendingCategoryTabId = trimmed;
} catch {
/* ignore */
}
}
/** 若无待处理 id 则返回 null;返回后清空,避免残留在全局 */
export function takePendingCategoryTabId(): string | null {
try {
const app = getApp<IAppOption>();
const raw = app.globalData.pendingCategoryTabId;
if (raw == null || String(raw).trim() === '') return null;
const v = String(raw).trim();
delete app.globalData.pendingCategoryTabId;
return v;
} catch {
return null;
}
}