index.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <template>
  2. <Drawer
  3. v-if="getIsMobile && getShowSidebar"
  4. placement="left"
  5. :class="prefixCls"
  6. :width="getMenuWidth"
  7. :getContainer="null"
  8. :visible="!getCollapsed"
  9. @close="handleClose"
  10. >
  11. <Sider />
  12. </Drawer>
  13. <MixSider v-else-if="getIsMixSidebar" />
  14. <BottomSider v-else-if="getIsBottomMenu" />
  15. <Sider v-else />
  16. </template>
  17. <script lang="ts">
  18. import { defineComponent } from 'vue';
  19. import Sider from './LayoutSider.vue';
  20. import MixSider from './MixSider.vue';
  21. import BottomSider from './bottomSideder.vue';
  22. import { Drawer } from 'ant-design-vue';
  23. import { useAppInject } from '/@/hooks/web/useAppInject';
  24. import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
  25. import { useDesign } from '/@/hooks/web/useDesign';
  26. export default defineComponent({
  27. name: 'SiderWrapper',
  28. components: { Sider, Drawer, MixSider, BottomSider },
  29. setup() {
  30. const { prefixCls } = useDesign('layout-sider-wrapper');
  31. const { getIsMobile } = useAppInject();
  32. const { setMenuSetting, getCollapsed, getMenuWidth, getIsMixSidebar, getIsBottomMenu, getIsBottomMenuH, getShowSidebar } = useMenuSetting();
  33. function handleClose() {
  34. setMenuSetting({
  35. collapsed: true,
  36. });
  37. }
  38. return { prefixCls, getIsMobile, getCollapsed, handleClose, getMenuWidth, getIsMixSidebar, getIsBottomMenu, getIsBottomMenuH, getShowSidebar, };
  39. },
  40. });
  41. </script>
  42. <style lang="less">
  43. @prefix-cls: ~'@{namespace}-layout-sider-wrapper';
  44. .@{prefix-cls} {
  45. .ant-drawer-body {
  46. height: 100vh;
  47. padding: 0;
  48. }
  49. .ant-drawer-header-no-title {
  50. display: none;
  51. }
  52. }
  53. </style>