20260817172952

This commit is contained in:
oneao committed 2026-08-17 17:29:54 +08:00
1 parent 4ef678ba65
commit 5bbd3c88b4
1865 files changed
+2261 -901

No files matched your search

+26 -2
View File
@@ -44,6 +44,30 @@ export const useAppStore = defineStore('app', {
const index = this.visitedTabs.findIndex((t) => t.key === key)
if (index >= 0) this.visitedTabs.splice(index, 1)
},
/** 关闭其他:保留工作台(不可关)与指定 key */
closeOthers(key) {
this.visitedTabs = this.visitedTabs.filter(
(t) => t.key === '/dashboard' || t.key === key,
)
},
/** 关闭左侧:保留工作台与指定 key 及其右侧 */
closeLeft(key) {
const idx = this.visitedTabs.findIndex((t) => t.key === key)
if (idx <= 0) return
this.visitedTabs = this.visitedTabs.filter(
(t, i) => i >= idx || t.key === '/dashboard',
)
},
/** 关闭右侧:保留指定 key 及其左侧(含工作台) */
closeRight(key) {
const idx = this.visitedTabs.findIndex((t) => t.key === key)
if (idx < 0) return
this.visitedTabs = this.visitedTabs.filter((t, i) => i <= idx)
},
/** 关闭全部:仅保留工作台 */
closeAll() {
this.visitedTabs = this.visitedTabs.filter((t) => t.key === '/dashboard')
},
getRouteRefreshKey(key) {
return this.routeRefreshKeys[key] ?? 0
},
@@ -52,9 +76,9 @@ export const useAppStore = defineStore('app', {
},
},
// 持久化状态:刷新后保持主题/侧栏/语言/页签;routeRefreshKeys 不持久化(仅本次会话有效)
// 持久化状态:仅持久化主题与语言;sidebarCollapsed / visitedTabs / routeRefreshKeys 不持久化(本次会话有效,刷新恢复默认)
persist: {
pick: ['darkMode', 'primaryColor', 'sidebarCollapsed', 'locale', 'visitedTabs'],
pick: ['darkMode', 'primaryColor', 'locale'],
},
})