eight
2024-12-02 356e2260338c817bdb8698d7f487d55db131c2ce
页面关闭自动登出
已修改1个文件
21 ■■■■■ 文件已修改
src/App.vue 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/App.vue
@@ -4,8 +4,14 @@
import { useDesign } from '@/hooks/web/useDesign'
import { CACHE_KEY, useCache } from '@/hooks/web/useCache'
import routerSearch from '@/components/RouterSearch/index.vue'
import {useUserStore} from "@/store/modules/user";
import {useTagsViewStore} from "@/store/modules/tagsView";
defineOptions({ name: 'APP' })
const userStore = useUserStore()
const tagsViewStore = useTagsViewStore()
const { getPrefixCls } = useDesign()
const prefixCls = getPrefixCls('app')
@@ -23,6 +29,21 @@
  appStore.setIsDark(isDarkTheme)
}
setDefaultTheme()
/** 初始化 **/
onMounted(() => {
  window.addEventListener('unload', handleUnload);
})
onBeforeUnmount(() => {
  window.removeEventListener('unload', handleUnload);
})
const handleUnload = async () => {
  await userStore.loginOut()
  tagsViewStore.delAllViews()
}
</script>
<template>
  <ConfigGlobal :size="currentSize">