You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.0 KiB

import { defineStore } from 'pinia';
interface AppConfig {
projectType: string;
baseApi: string;
timeout: number;
pagePermission: boolean;
actionPermission: boolean;
customAppTitle?: boolean;
layout?: Function;
headerBellInfo?: object;
customInitMessageCount?: Function | Boolean; // 自定义消息数量获取事件
}
export const appConfigStore = defineStore({
id: 'appConfig',
/**
* module 测试用
* @returns
*/
state(): AppConfig {
return {
projectType: 'web',
baseApi: '/api',
timeout: 15 * 1000,
pagePermission: true,
actionPermission: true,
customAppTitle: false,
customInitMessageCount: false,
headerBellInfo: {
isShow: false,
api: '',
toRouterName: '',
},
};
},
getters: {
getHeaderBellInfo: (state: any) => state.headerBellInfo,
},
actions: {
setConfig(config: AppConfig) {
Object.keys(config).forEach((key) => {
this[key] = config[key];
});
},
},
});