|
|
@@ -1,64 +1,20 @@
|
|
|
-<script setup lang="ts">
|
|
|
-import logo from '@assets/images/logo.webp';
|
|
|
-import MenuBtnGroup from './menu-btn-group/index.vue';
|
|
|
-import User from './user/index.vue';
|
|
|
-import Local from './local/index.vue';
|
|
|
-import Menu from './menu/index.vue';
|
|
|
-import {NLayout, NLayoutContent, NScrollbar} from 'naive-ui';
|
|
|
-import TabList from './tab/index.vue';
|
|
|
-import {RouterView, useRoute} from 'vue-router';
|
|
|
-import {computed} from 'vue';
|
|
|
-import {useTabStore} from '@stores';
|
|
|
-import {RouteNameMap} from '@routes';
|
|
|
+<script setup lang='ts'>
|
|
|
+import Home from './Home.vue';
|
|
|
+import {LDSuspenseLoading} from '@components';
|
|
|
+import {useI18n} from 'vue-i18n';
|
|
|
|
|
|
-defineOptions({
|
|
|
- name: 'Home',
|
|
|
-});
|
|
|
-
|
|
|
-const route = useRoute();
|
|
|
-const tabStore = useTabStore();
|
|
|
-
|
|
|
-// 只保留tab上有的页面 销毁的不考虑
|
|
|
-const keepaliveKeys = computed(function() {
|
|
|
- return tabStore.tabList.map(function(val) {
|
|
|
- return RouteNameMap.get(val.url);
|
|
|
- });
|
|
|
-});
|
|
|
+defineOptions({name: 'HomeWrapper'});
|
|
|
|
|
|
+const {t} = useI18n();
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div class="container">
|
|
|
- <header>
|
|
|
- <section class="logo" @click="tabStore.setActiveKey('-1')">
|
|
|
- <img :src="logo" alt="logo" />
|
|
|
- <h1 v-t="'common.title'" />
|
|
|
- </section>
|
|
|
- <MenuBtnGroup />
|
|
|
- <User />
|
|
|
- <Local />
|
|
|
- </header>
|
|
|
-
|
|
|
- <NLayout class="content" hasSider>
|
|
|
- <Menu />
|
|
|
- <NLayoutContent>
|
|
|
- <section class="content-info">
|
|
|
- <TabList />
|
|
|
- <NScrollbar>
|
|
|
- <div class="content-main">
|
|
|
- <RouterView #="{Component}">
|
|
|
- <KeepAlive :include="keepaliveKeys">
|
|
|
- <component :is="Component" :key="route.path" />
|
|
|
- </KeepAlive>
|
|
|
- </RouterView>
|
|
|
- </div>
|
|
|
- </NScrollbar>
|
|
|
- </section>
|
|
|
- </NLayoutContent>
|
|
|
- </NLayout>
|
|
|
- </div>
|
|
|
+ <Suspense>
|
|
|
+ <template #fallback>
|
|
|
+ <main style="width: 100vw; height: 100vh;">
|
|
|
+ <LDSuspenseLoading :msg="t('home.loading')" />
|
|
|
+ </main>
|
|
|
+ </template>
|
|
|
+ <Home />
|
|
|
+ </Suspense>
|
|
|
</template>
|
|
|
-
|
|
|
-<style scoped>
|
|
|
-@import './index.css';
|
|
|
-</style>
|