20260715221223
This commit is contained in:
1 parent
7049584d1e
commit
704dda07b5
21 files changed
+2649
-427
No files matched your search
@@ -0,0 +1,29 @@
|
||||
import { defineStore } from "pinia";
|
||||
|
||||
export const useAppStore = defineStore("app", {
|
||||
state: () => ({
|
||||
locale: "zh-CN",
|
||||
sidebarCollapsed: false,
|
||||
visitedTabs: [{ key: "/dashboard", label: "工作台", closable: false }],
|
||||
}),
|
||||
actions: {
|
||||
toggleSidebar() {
|
||||
this.sidebarCollapsed = !this.sidebarCollapsed;
|
||||
},
|
||||
setLocale(locale) {
|
||||
this.locale = locale;
|
||||
},
|
||||
addVisitedTab(tab) {
|
||||
if (!this.visitedTabs.some((item) => item.key === tab.key)) {
|
||||
this.visitedTabs.push(tab);
|
||||
}
|
||||
},
|
||||
removeVisitedTab(key) {
|
||||
this.visitedTabs = this.visitedTabs.filter((item) => item.key !== key);
|
||||
},
|
||||
},
|
||||
persist: {
|
||||
key: "fms-app",
|
||||
pick: ["locale", "sidebarCollapsed", "visitedTabs"],
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user