admin/src/store/global.ts

34 lines
685 B
TypeScript

import tools from "@/utils/tools";
import config from "@/config";
import {defineStore} from "pinia";
const globalStore = defineStore('global', {
state: () => ({
//移动端布局
isMobile: false,
//布局
layout: tools.data.get('APP_LAYOUT') || config.APP_LAYOUT || 'header',
//菜单是否折叠 toggle
menuIsCollapse: false,
//多标签栏
layoutTags: true
}),
actions: {
SET_isMobile(key) {
this.isMobile = key
},
SET_layout(key) {
this.layout = key
},
TOGGLE_menuIsCollapse() {
this.menuIsCollapse = !this.menuIsCollapse
},
TOGGLE_layoutTags() {
this.layoutTags = !this.layoutTags
}
},
persist: true
})
export default globalStore