index.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <template>
  2. <div class="layout-wrapper">
  3. <component :is="currentLayoutComponent" />
  4. <!-- 设置面板 - 独立于布局组件 -->
  5. <Settings v-if="isShowSettings" />
  6. </div>
  7. </template>
  8. <script setup lang="ts">
  9. import { computed } from "vue";
  10. import { useLayout } from "./composables/useLayout";
  11. import LeftLayout from "./views/LeftLayout.vue";
  12. import TopLayout from "./views/TopLayout.vue";
  13. import MixLayout from "./views/MixLayout.vue";
  14. import Settings from "./components/Settings/index.vue";
  15. import { LayoutMode } from "@/enums/settings/layout.enum";
  16. const { currentLayout, isShowSettings } = useLayout();
  17. // 根据当前布局模式选择对应的组件
  18. const currentLayoutComponent = computed(() => {
  19. switch (currentLayout.value) {
  20. case LayoutMode.MIX:
  21. return MixLayout;
  22. case LayoutMode.LEFT:
  23. return LeftLayout;
  24. case LayoutMode.TOP:
  25. default:
  26. return TopLayout;
  27. }
  28. });
  29. </script>
  30. <style lang="scss" scoped>
  31. .layout-wrapper {
  32. width: 100%;
  33. height: 100%;
  34. }
  35. </style>