index.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <!-- 💥 这里是一次性加载 LayoutComponents -->
  2. <template>
  3. <component :is="LayoutComponents[layout]" />
  4. <!-- <ThemeDrawer />-->
  5. <RightPanel v-if="showSettings">
  6. <Settings />
  7. </RightPanel>
  8. </template>
  9. <script setup lang="ts" name="layout">
  10. import { computed, type Component } from 'vue'
  11. import { LayoutType } from '@/store/interface'
  12. import useStore from '@/store'
  13. import RightPanel from '@/components/RightPanel/index.vue'
  14. import LayoutTop from './LayoutTop/index.vue'
  15. import LayoutTopMix from './LayoutTopMix/index.vue'
  16. import LayoutLeft from './LayoutLeft/index.vue'
  17. import LayoutLeftMix from './LayoutLeftMix/index.vue'
  18. import { Settings } from '@/layout/components'
  19. const LayoutComponents: Record<LayoutType, Component> = {
  20. topMix: LayoutTopMix,
  21. top: LayoutTop,
  22. left: LayoutLeft,
  23. leftMix: LayoutLeftMix
  24. }
  25. const { setting } = useStore()
  26. const layout = computed(() => setting.layout)
  27. const showSettings = computed(() => setting.showSettings)
  28. </script>
  29. <style scoped lang="scss">
  30. .layout {
  31. min-width: 600px;
  32. }
  33. </style>