37 lines
841 B
Vue
37 lines
841 B
Vue
<template>
|
||
<a-config-provider :locale="zhCN" size="small" :theme="redTheme">
|
||
<router-view v-if="$route.path === '/login'" />
|
||
<LayoutBasic v-else />
|
||
</a-config-provider>
|
||
</template>
|
||
|
||
<script setup lang="ts">
|
||
import { useUserStore } from '@/stores';
|
||
import zhCN from '@arco-design/web-vue/es/locale/lang/zh-cn';
|
||
const userStore = useUserStore();
|
||
|
||
const redTheme = {
|
||
token: {
|
||
colorPrimary: '#6d4cfe', // 主色
|
||
colorLink: '#f5222d', // 链接色
|
||
},
|
||
};
|
||
|
||
const init = () => {
|
||
const { isLogin, fetchUserInfo } = userStore;
|
||
if (isLogin) {
|
||
fetchUserInfo();
|
||
}
|
||
};
|
||
|
||
onMounted(() => {
|
||
init();
|
||
// 监听全局未处理错误
|
||
window.addEventListener('unhandledrejection', (event) => {
|
||
event.preventDefault();
|
||
console.log(event);
|
||
console.error(`发现catch报错:${event.reason}`);
|
||
});
|
||
});
|
||
</script>
|