优化卡片

This commit is contained in:
hero920103 committed 2026-11-05 01:08:55 +08:00
1 parent e34543465a
commit 8acbe732ff
8 files changed
+181 -21

No files matched your search

+11
View File
@@ -99,8 +99,19 @@ export const useTabsStore = defineTabsStore('tabs', () => {
function setDefaultTab(tab) {
const path = tab?.fullPath || '';
if (!path) return;
const prevDefault = defaultDashboardPath.value;
defaultDashboardPath.value = path;
// 默认工作台路径变化 = 切换了模块:关闭旧模块的全部 tab,
// 只保留新模块的默认工作台。
// prevDefault 为空(首次设置,如刷新后恢复)时不清空,保留恢复出来的 tabs。
if (prevDefault && prevDefault !== path) {
tabList.value = [tab];
activeTab.value = path;
saveTabsToStorage(tabList.value, activeTab.value);
return;
}
const idx = tabList.value.findIndex(t => t.fullPath === path);
if (idx === -1) {
tabList.value.unshift(tab);