提交 | 用户 | age
|
99ac30
|
1 |
<template> |
1d7608
|
2 |
<RouterView> |
V |
3 |
<template #default="{ Component, route }"> |
|
4 |
<transition |
|
5 |
:name=" |
|
6 |
getTransitionName({ |
|
7 |
route, |
|
8 |
openCache, |
|
9 |
enableTransition: getEnableTransition, |
|
10 |
cacheTabs: getCaches, |
|
11 |
def: getBasicTransition, |
|
12 |
}) |
|
13 |
" |
|
14 |
mode="out-in" |
|
15 |
appear |
|
16 |
> |
|
17 |
<keep-alive v-if="openCache" :include="getCaches"> |
|
18 |
<component :is="Component" :key="route.fullPath" /> |
|
19 |
</keep-alive> |
|
20 |
<component v-else :is="Component" :key="route.fullPath" /> |
|
21 |
</transition> |
|
22 |
</template> |
|
23 |
</RouterView> |
|
24 |
<FrameLayout v-if="getCanEmbedIFramePage" /> |
99ac30
|
25 |
</template> |
V |
26 |
|
|
27 |
<script lang="ts"> |
|
28 |
import { computed, defineComponent, unref } from 'vue'; |
|
29 |
|
|
30 |
import FrameLayout from '/@/layouts/iframe/index.vue'; |
|
31 |
|
|
32 |
import { useRootSetting } from '/@/hooks/setting/useRootSetting'; |
|
33 |
|
|
34 |
import { useTransitionSetting } from '/@/hooks/setting/useTransitionSetting'; |
|
35 |
import { useMultipleTabSetting } from '/@/hooks/setting/useMultipleTabSetting'; |
|
36 |
import { getTransitionName } from './transition'; |
e12c58
|
37 |
|
215d8b
|
38 |
import { useMultipleTabStore } from '/@/store/modules/multipleTab'; |
99ac30
|
39 |
|
V |
40 |
export default defineComponent({ |
|
41 |
name: 'PageLayout', |
|
42 |
components: { FrameLayout }, |
|
43 |
setup() { |
|
44 |
const { getShowMultipleTab } = useMultipleTabSetting(); |
215d8b
|
45 |
const tabStore = useMultipleTabStore(); |
99ac30
|
46 |
|
V |
47 |
const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting(); |
|
48 |
|
|
49 |
const { getBasicTransition, getEnableTransition } = useTransitionSetting(); |
|
50 |
|
|
51 |
const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab)); |
|
52 |
|
e12c58
|
53 |
const getCaches = computed((): string[] => { |
V |
54 |
if (!unref(getOpenKeepAlive)) { |
|
55 |
return []; |
|
56 |
} |
215d8b
|
57 |
return tabStore.getCachedTabList; |
e12c58
|
58 |
}); |
V |
59 |
|
99ac30
|
60 |
return { |
V |
61 |
getTransitionName, |
|
62 |
openCache, |
|
63 |
getEnableTransition, |
|
64 |
getBasicTransition, |
|
65 |
getCaches, |
|
66 |
getCanEmbedIFramePage, |
|
67 |
}; |
|
68 |
}, |
|
69 |
}); |
|
70 |
</script> |