mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-11-13 20:23:42 +08:00
feat(projects): 添加生产的主题配置缓存
This commit is contained in:
14
src/composables/events.ts
Normal file
14
src/composables/events.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { useEventListener } from '@vueuse/core';
|
||||
import { useThemeStore, useTabStore } from '@/store';
|
||||
|
||||
/** 全局事件 */
|
||||
export function useGlobalEvents() {
|
||||
const theme = useThemeStore();
|
||||
const tab = useTabStore();
|
||||
|
||||
/** 页面离开时缓存多页签数据 */
|
||||
useEventListener(window, 'beforeunload', () => {
|
||||
theme.cacheThemeSettings();
|
||||
tab.cacheTabRoutes();
|
||||
});
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './system';
|
||||
export * from './router';
|
||||
export * from './layout';
|
||||
export * from './events';
|
||||
export * from './echarts';
|
||||
|
||||
Reference in New Issue
Block a user