initHeader
This commit is contained in:
54
frontend/src/stores/modules/global.ts
Normal file
54
frontend/src/stores/modules/global.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { GlobalState } from "@/stores/interface";
|
||||
import { DEFAULT_PRIMARY } from "@/config";
|
||||
import piniaPersistConfig from "@/stores/helper/persist";
|
||||
import {GLOBAL_STORE_KEY} from "@/stores/constant";
|
||||
|
||||
export const useGlobalStore = defineStore({
|
||||
id: GLOBAL_STORE_KEY,
|
||||
// 修改默认值之后,需清除 localStorage 数据
|
||||
state: (): GlobalState => ({
|
||||
// 布局模式 (纵向:vertical | 经典:classic | 横向:transverse | 分栏:columns)
|
||||
layout: "transverse",
|
||||
// element 组件大小
|
||||
assemblySize: "default",
|
||||
// 当前系统语言
|
||||
language: null,
|
||||
// 当前页面是否全屏
|
||||
maximize: false,
|
||||
// 主题颜色
|
||||
primary: DEFAULT_PRIMARY,
|
||||
// 深色模式
|
||||
isDark: false,
|
||||
// 灰色模式
|
||||
isGrey: false,
|
||||
// 色弱模式
|
||||
isWeak: false,
|
||||
// 侧边栏反转
|
||||
asideInverted: false,
|
||||
// 头部反转
|
||||
headerInverted: false,
|
||||
// 折叠菜单
|
||||
isCollapse: false,
|
||||
// 菜单手风琴
|
||||
accordion: true,
|
||||
// 面包屑导航
|
||||
breadcrumb: true,
|
||||
// 面包屑导航图标
|
||||
breadcrumbIcon: true,
|
||||
// 标签页
|
||||
tabs: true,
|
||||
// 标签页图标
|
||||
tabsIcon: true,
|
||||
// 页脚
|
||||
footer: false
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
// Set GlobalState
|
||||
setGlobalState(...args: ObjToKeyValArray<GlobalState>) {
|
||||
this.$patch({ [args[0]]: args[1] });
|
||||
}
|
||||
},
|
||||
persist: piniaPersistConfig(GLOBAL_STORE_KEY)
|
||||
});
|
||||
Reference in New Issue
Block a user