feat: 首页跳转到分类页指定分类优化
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user