mirror of
https://github.com/soybeanjs/soybean-admin.git
synced 2025-09-18 17:46:38 +08:00
15 lines
386 B
TypeScript
15 lines
386 B
TypeScript
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();
|
|
});
|
|
}
|