index.vue 2.4 KB

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