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(() => {
  49. return unref(getOpenKeepAlive) && unref(getShowMultipleTab)
  50. });
  51. const getCaches = computed((): string[] => {
  52. if (!unref(getOpenKeepAlive)) {
  53. return [];
  54. }
  55. return tabStore.getCachedTabList;
  56. });
  57. return {
  58. getTransitionName,
  59. openCache,
  60. getEnableTransition,
  61. getBasicTransition,
  62. getCaches,
  63. getCanEmbedIFramePage,
  64. };
  65. },
  66. });
  67. </script>
  68. <style scoped lang="less">
  69. .page{
  70. height: 100%;
  71. }
  72. </style>