BasicLayout.vue 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <script setup lang="ts">
  2. import { useRouterStore } from '@/stores/router'
  3. import { useThemeStore } from '@/stores/theme'
  4. import { isMicro } from '@/utils/micro'
  5. const routerStore = useRouterStore()
  6. const themeStore = useThemeStore()
  7. </script>
  8. <template>
  9. <div class="h-full" v-if="isMicro">
  10. <router-view v-slot="{ Component }">
  11. <keep-alive :include="themeStore.keepAliveTabs ? routerStore.keepAliveRouter : []">
  12. <component :is="Component" />
  13. </keep-alive>
  14. </router-view>
  15. </div>
  16. <el-container class="layout-container" v-else>
  17. <el-header v-if="themeStore.logoInHeader">
  18. <global-header />
  19. </el-header>
  20. <el-container
  21. :style="{ height: themeStore.logoInHeader ? 'calc(100% - var(--el-menu-horizontal-height))' : '100%' }"
  22. >
  23. <el-aside>
  24. <global-aside />
  25. </el-aside>
  26. <el-container>
  27. <el-header v-if="!themeStore.logoInHeader">
  28. <global-header />
  29. </el-header>
  30. <el-main style="padding: 0">
  31. <global-tabs v-if="themeStore.showTabs"></global-tabs>
  32. <div
  33. class="overflow-auto"
  34. style="padding: var(--main-padding)"
  35. :style="{ height: themeStore.showTabs ? 'calc(100% - 41px)' : '100%' }"
  36. >
  37. <router-view v-slot="{ Component }">
  38. <keep-alive :include="themeStore.keepAliveTabs ? routerStore.keepAliveRouter : []">
  39. <component :is="Component" />
  40. </keep-alive>
  41. </router-view>
  42. </div>
  43. </el-main>
  44. <!-- <el-footer>
  45. <global-footer />
  46. </el-footer> -->
  47. </el-container>
  48. </el-container>
  49. </el-container>
  50. </template>
  51. <style scoped>
  52. .layout-container {
  53. height: 100%;
  54. }
  55. .el-header,
  56. .el-footer {
  57. padding: 0;
  58. }
  59. .el-main {
  60. padding: var(--main-padding);
  61. }
  62. </style>