提交 | 用户 | 时间
|
820397
|
1 |
<script lang="ts" setup> |
H |
2 |
import { useTagsViewStore } from '@/store/modules/tagsView' |
|
3 |
import { useAppStore } from '@/store/modules/app' |
|
4 |
import { Footer } from '@/layout/components/Footer' |
|
5 |
|
|
6 |
defineOptions({ name: 'AppView' }) |
|
7 |
|
|
8 |
const appStore = useAppStore() |
|
9 |
|
|
10 |
const layout = computed(() => appStore.getLayout) |
|
11 |
|
|
12 |
const fixedHeader = computed(() => appStore.getFixedHeader) |
|
13 |
|
|
14 |
const footer = computed(() => appStore.getFooter) |
|
15 |
|
|
16 |
const tagsViewStore = useTagsViewStore() |
|
17 |
|
|
18 |
const getCaches = computed((): string[] => { |
|
19 |
return tagsViewStore.getCachedViews |
|
20 |
}) |
|
21 |
|
|
22 |
const tagsView = computed(() => appStore.getTagsView) |
|
23 |
|
|
24 |
//region 无感刷新 |
|
25 |
const routerAlive = ref(true) |
|
26 |
// 无感刷新,防止出现页面闪烁白屏 |
|
27 |
const reload = () => { |
|
28 |
routerAlive.value = false |
|
29 |
nextTick(() => (routerAlive.value = true)) |
|
30 |
} |
|
31 |
// 为组件后代提供刷新方法 |
|
32 |
provide('reload', reload) |
|
33 |
//endregion |
|
34 |
</script> |
|
35 |
|
|
36 |
<template> |
|
37 |
<section |
|
38 |
:class="[ |
3e359e
|
39 |
'p-[var(--app-content-padding)] w-full bg-[var(--app-content-bg-color)] dark:bg-[var(--el-bg-color)]', |
820397
|
40 |
{ |
3e359e
|
41 |
'!min-h-[calc(100vh-var(--top-tool-height)-var(--tags-view-height)-var(--app-footer-height))] pb-0': |
H |
42 |
footer |
820397
|
43 |
} |
H |
44 |
]" |
|
45 |
> |
|
46 |
<router-view v-if="routerAlive"> |
|
47 |
<template #default="{ Component, route }"> |
|
48 |
<keep-alive :include="getCaches"> |
|
49 |
<component :is="Component" :key="route.fullPath" /> |
|
50 |
</keep-alive> |
|
51 |
</template> |
|
52 |
</router-view> |
|
53 |
</section> |
|
54 |
<Footer v-if="footer" /> |
|
55 |
</template> |