Files
lingji-work-fe/src/App.vue
rd b626f5a35b refactor(layout): 优化页面布局显示逻辑
- 在 App.vue 中使用 route.meta.withoutLayout 替代原有的 route.path 和 route.name判断逻辑
- 在 router/index.ts 和 materialCenter.ts 中为需要独立布局的路由添加 withoutLayout: true 标记
- 更新 router/typeings.d.ts,添加 withoutLayout属性定义
2025-09-15 14:54:55 +08:00

60 lines
1.3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<ConfigProvider :locale="zhCN" :theme="redTheme">
<router-view v-if="$route.meta.withoutLayout" />
<LayoutBasic v-else />
</ConfigProvider>
</template>
<script setup>
import { useUserStore } from '@/stores';
// import { useChatStore } from '@/stores/modules/chat';
import { initApp } from '@/utils/user';
import { useSidebarStore } from '@/stores/modules/side-bar';
import { ConfigProvider } from 'ant-design-vue';
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import 'dayjs/locale/zh-cn';
const userStore = useUserStore();
// const route = useRoute();
const sidebarStore = useSidebarStore();
// const chatStore = useChatStore();
const redTheme = {
token: {
colorPrimary: '#6d4cfe', // 主色
colorLink: '#f5222d', // 链接色
},
};
const init = async () => {
const { isLogin } = userStore;
// 已开通
if (isLogin) {
await initApp();
} else {
sidebarStore.stopUnreadInfoPolling();
}
};
onMounted(() => {
init();
// 监听全局未处理错误
window.addEventListener('unhandledrejection', (event) => {
event.preventDefault();
console.log(event);
console.error(`发现catch报错${event.reason}`);
});
});
onUnmounted(() => {
sidebarStore.stopUnreadInfoPolling();
});
</script>
<style lang="scss">
@import './styles/index.scss';
</style>