index.vue 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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, getShowMenu } = useMenuSetting();
  44. // Create a lock screen monitor
  45. const lockEvents = useLockPage();
  46. const layoutClass = computed(() => {
  47. let cls: string[] = ['ant-layout'];
  48. if (unref(getIsMixSidebar) || unref(getShowMenu)) {
  49. cls.push('ant-layout-has-sider');
  50. }
  51. return cls;
  52. });
  53. return {
  54. getShowFullHeaderRef,
  55. getShowSidebar,
  56. prefixCls,
  57. getIsMobile,
  58. getIsMixSidebar,
  59. layoutClass,
  60. lockEvents,
  61. };
  62. },
  63. });
  64. </script>
  65. <style lang="less">
  66. @prefix-cls: ~'@{namespace}-default-layout';
  67. .@{prefix-cls} {
  68. display: flex;
  69. width: 100%;
  70. min-height: 100%;
  71. background-color: @content-bg;
  72. flex-direction: column;
  73. > .ant-layout {
  74. min-height: 100%;
  75. }
  76. &-main {
  77. width: 100%;
  78. margin-left: 1px;
  79. }
  80. }
  81. </style>