forked from admin/deShanXiao
初始版本,目前线上可用
This commit is contained in:
46
frontEnd/src/store/index.ts
Normal file
46
frontEnd/src/store/index.ts
Normal file
@@ -0,0 +1,46 @@
|
||||
import { defineStore } from "pinia"
|
||||
import { RouteRecordRaw } from "vue-router";
|
||||
|
||||
interface globalState {
|
||||
loadingShow: boolean;
|
||||
globalLodingShow: boolean;
|
||||
globalLodingShowText: string;
|
||||
currentMenue: RouteRecordRaw | null;
|
||||
historyRouterPath: string;
|
||||
loadingText: string
|
||||
}
|
||||
export const globalState = defineStore('globalState', {
|
||||
state(): globalState{
|
||||
return {
|
||||
loadingShow: false,
|
||||
loadingText: '',
|
||||
currentMenue: null,
|
||||
historyRouterPath: '/',
|
||||
globalLodingShow: false,
|
||||
globalLodingShowText: ""
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
setLoadingShow(state: boolean, showText = '请稍候...' ) {
|
||||
this.loadingShow = state;
|
||||
this.loadingText = showText;
|
||||
},
|
||||
toggleLoadingShow() {
|
||||
this.loadingShow = !this.loadingShow;
|
||||
},
|
||||
setSelectMenue(menue: RouteRecordRaw) {
|
||||
this.currentMenue = menue;
|
||||
},
|
||||
setHistoryRouterPath(path: string) {
|
||||
this.historyRouterPath = path;
|
||||
localStorage.setItem('historyRouterPath', path);
|
||||
},
|
||||
setLoadingText(text:string) {
|
||||
this.loadingText = text;
|
||||
},
|
||||
setGlobalLoadingShow(state: boolean, showText = '请稍候...') {
|
||||
this.globalLodingShow = state;
|
||||
this.globalLodingShowText = showText;
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user