index.vue 2.2 KB

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