mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2025-12-08 17:12:28 +08:00
v3.7.2 版本代码合并
This commit is contained in:
@ -1,9 +1,19 @@
|
||||
import type { App } from 'vue';
|
||||
import type { Pinia } from 'pinia';
|
||||
import { createPinia } from 'pinia';
|
||||
const store = createPinia();
|
||||
|
||||
let store: Nullable<Pinia> = null;
|
||||
|
||||
export function setupStore(app: App<Element>) {
|
||||
if (store == null) {
|
||||
store = createPinia();
|
||||
}
|
||||
app.use(store);
|
||||
}
|
||||
|
||||
// 销毁store
|
||||
export function destroyStore() {
|
||||
store = null;
|
||||
}
|
||||
|
||||
export { store };
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
import type { MainAppProps } from "#/main";
|
||||
import type { ProjectConfig, HeaderSetting, MenuSetting, TransitionSetting, MultiTabsSetting } from '/#/config';
|
||||
import type { BeforeMiniState } from '/#/store';
|
||||
|
||||
@ -20,7 +21,9 @@ interface AppState {
|
||||
// When the window shrinks, remember some states, and restore these states when the window is restored
|
||||
beforeMiniInfo: BeforeMiniState;
|
||||
// 页面跳转临时参数存储
|
||||
messageHrefParams: any
|
||||
messageHrefParams: any,
|
||||
// 应用参数
|
||||
mainAppProps: MainAppProps,
|
||||
}
|
||||
let timeId: TimeoutHandle;
|
||||
export const useAppStore = defineStore({
|
||||
@ -30,7 +33,8 @@ export const useAppStore = defineStore({
|
||||
pageLoading: false,
|
||||
projectConfig: Persistent.getLocal(PROJ_CFG_KEY),
|
||||
beforeMiniInfo: {},
|
||||
messageHrefParams: {}
|
||||
messageHrefParams: {},
|
||||
mainAppProps: {},
|
||||
}),
|
||||
getters: {
|
||||
getPageLoading(): boolean {
|
||||
@ -62,7 +66,10 @@ export const useAppStore = defineStore({
|
||||
},
|
||||
getMessageHrefParams():any{
|
||||
return this.messageHrefParams;
|
||||
}
|
||||
},
|
||||
getMainAppProps(): MainAppProps {
|
||||
return this.mainAppProps;
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
setPageLoading(loading: boolean): void {
|
||||
@ -104,7 +111,14 @@ export const useAppStore = defineStore({
|
||||
setMessageHrefParams(params: any): void {
|
||||
this.messageHrefParams = params;
|
||||
},
|
||||
|
||||
|
||||
// 设置主应用参数
|
||||
setMainAppProps(args: MainAppProps) {
|
||||
this.mainAppProps.hideHeader = args.hideHeader ?? false;
|
||||
this.mainAppProps.hideSider = args.hideSider ?? false;
|
||||
this.mainAppProps.hideMultiTabs = args.hideMultiTabs ?? false;
|
||||
},
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user