Files
jiebanke/admin-system/src/App.vue

45 lines
935 B
Vue
Raw Normal View History

2025-08-30 14:33:49 +08:00
<template>
<a-config-provider :locale="zhCN">
2025-08-31 21:06:52 +08:00
<component :is="layout">
<router-view />
</component>
2025-08-30 14:33:49 +08:00
</a-config-provider>
</template>
<script setup lang="ts">
2025-08-31 21:06:52 +08:00
import { computed } from 'vue'
import { useRoute } from 'vue-router'
2025-08-30 14:33:49 +08:00
import { useAppStore } from '@/stores/app'
2025-08-31 21:06:52 +08:00
import MainLayout from '@/layouts/MainLayout.vue'
import zhCN from 'ant-design-vue/es/locale/zh_CN'
2025-08-30 14:33:49 +08:00
2025-08-31 21:06:52 +08:00
const route = useRoute()
2025-08-30 14:33:49 +08:00
const appStore = useAppStore()
2025-08-31 21:06:52 +08:00
// 根据路由元信息确定使用的布局
const layout = computed(() => {
const layoutName = route.meta?.layout || 'default'
2025-08-30 14:33:49 +08:00
2025-08-31 21:06:52 +08:00
if (layoutName === 'main') {
return MainLayout
2025-08-30 14:33:49 +08:00
}
2025-08-31 21:06:52 +08:00
// 默认布局(如登录页)
return 'div'
2025-08-30 14:33:49 +08:00
})
2025-08-31 21:06:52 +08:00
// 初始化应用
appStore.initialize()
// 开发环境调试信息
if (import.meta.env.DEV) {
console.log('🎯 应用组件挂载完成')
}
2025-08-30 14:33:49 +08:00
</script>
<style scoped>
#app {
min-height: 100vh;
background-color: #f5f5f5;
}
</style>