| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <template>
- <RouterView>
- <template #default="{ Component, route }">
- <!--<transition
- :name="
- getTransitionName({
- route,
- openCache,
- enableTransition: getEnableTransition,
- cacheTabs: getCaches,
- def: getBasicTransition,
- })
- "
- mode="out-in"
- appear
- >-->
- <keep-alive v-if="openCache" :include="getCaches">
- <component :is="Component" :key="getPageComponentKey(route)" />
- </keep-alive>
- <component v-else :is="Component" :key="getPageComponentKey(route)" />
- <!--</transition>-->
- </template>
- </RouterView>
- <FrameLayout v-if="getCanEmbedIFramePage" />
- </template>
- <script lang="ts">
- import { computed, defineComponent, unref } from 'vue';
- import type { RouteLocationNormalizedLoaded } from 'vue-router';
- import FrameLayout from '@jeesite/core/layouts/iframe/index.vue';
- import { useRootSetting } from '@jeesite/core/hooks/setting/useRootSetting';
- import { useTransitionSetting } from '@jeesite/core/hooks/setting/useTransitionSetting';
- import { useMultipleTabSetting } from '@jeesite/core/hooks/setting/useMultipleTabSetting';
- import { getTransitionName } from './transition';
- import { useMultipleTabStore } from '@jeesite/core/store/modules/multipleTab';
- export default defineComponent({
- name: 'PageLayout',
- components: { FrameLayout },
- setup() {
- const { getShowMultipleTab } = useMultipleTabSetting();
- const tabStore = useMultipleTabStore();
- const { getOpenKeepAlive, getCanEmbedIFramePage } = useRootSetting();
- const { getBasicTransition, getEnableTransition } = useTransitionSetting();
- const openCache = computed(() => unref(getOpenKeepAlive) && unref(getShowMultipleTab));
- const getCaches = computed((): string[] => {
- if (!unref(getOpenKeepAlive)) {
- return [];
- }
- return tabStore.getCachedTabList;
- });
- const getPageComponentKey = (route: RouteLocationNormalizedLoaded) => {
- const fullPath = route.fullPath || route.path;
- return route.path === '/behaviorSpacetime/index' ? route.path : fullPath;
- };
- return {
- getTransitionName,
- openCache,
- getEnableTransition,
- getBasicTransition,
- getCaches,
- getPageComponentKey,
- getCanEmbedIFramePage,
- };
- },
- });
- </script>
|