index.vue 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <Layout :class="prefixCls" v-bind="lockEvents">
  3. <LayoutFeatures />
  4. <LayoutHeader fixed v-if="getShowFullHeaderRef" />
  5. <Layout :class="layoutClass">
  6. <LayoutSideBar v-if="getShowSidebar || getIsMobile" />
  7. <Layout :class="`${prefixCls}-main`">
  8. <LayoutMultipleHeader />
  9. <LayoutContent />
  10. <LayoutFooter />
  11. </Layout>
  12. </Layout>
  13. </Layout>
  14. </template>
  15. <script lang="ts">
  16. import { defineComponent, computed, unref } from 'vue';
  17. import { Layout } from 'ant-design-vue';
  18. import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent';
  19. import LayoutHeader from './header/index.vue';
  20. import LayoutContent from './content/index.vue';
  21. import LayoutSideBar from './sider/index.vue';
  22. import LayoutMultipleHeader from './header/MultipleHeader.vue';
  23. import { useHeaderSetting } from '/@/hooks/setting/useHeaderSetting';
  24. import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
  25. import { useDesign } from '/@/hooks/web/useDesign';
  26. import { useLockPage } from '/@/hooks/web/useLockPage';
  27. import { useAppInject } from '/@/hooks/web/useAppInject';
  28. export default defineComponent({
  29. name: 'DefaultLayout',
  30. components: {
  31. LayoutFeatures: createAsyncComponent(() => import('/@/layouts/default/feature/index.vue')),
  32. LayoutFooter: createAsyncComponent(() => import('/@/layouts/default/footer/index.vue')),
  33. LayoutHeader,
  34. LayoutContent,
  35. LayoutSideBar,
  36. LayoutMultipleHeader,
  37. Layout,
  38. },
  39. setup() {
  40. const { prefixCls } = useDesign('default-layout');
  41. const { getIsMobile } = useAppInject();
  42. const { getShowFullHeaderRef } = useHeaderSetting();
  43. const { getShowSidebar, getIsMixSidebar } = useMenuSetting();
  44. // Create a lock screen monitor
  45. const lockEvents = useLockPage();
  46. const layoutClass = computed(() => ({ 'ant-layout-has-sider': unref(getIsMixSidebar) }));
  47. return {
  48. getShowFullHeaderRef,
  49. getShowSidebar,
  50. prefixCls,
  51. getIsMobile,
  52. getIsMixSidebar,
  53. layoutClass,
  54. lockEvents,
  55. };
  56. },
  57. });
  58. </script>
  59. <style lang="less">
  60. @prefix-cls: ~'@{namespace}-default-layout';
  61. .@{prefix-cls} {
  62. display: flex;
  63. width: 100%;
  64. min-height: 100%;
  65. background-color: @content-bg;
  66. flex-direction: column;
  67. > .ant-layout {
  68. min-height: 100%;
  69. }
  70. &-main {
  71. margin-left: 1px;
  72. }
  73. }
  74. </style>