Commit 1e5fcd2cd2981b29f06cff08e588077b2dd02f45

Authored by vben
1 parent 0e7c57bd

feat: added mixSide trigger

src/hooks/setting/useMenuSetting.ts
... ... @@ -93,8 +93,10 @@ const getCalcContentWidth = computed(() => {
93 93 unref(getIsTopMenu) || !unref(getShowMenu) || (unref(getSplit) && unref(getMenuHidden))
94 94 ? 0
95 95 : unref(getIsMixSidebar)
96   - ? SIDE_BAR_SHOW_TIT_MINI_WIDTH +
97   - (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0)
  96 + ? unref(getCollapsed)
  97 + ? SIDE_BAR_MINI_WIDTH
  98 + : SIDE_BAR_SHOW_TIT_MINI_WIDTH +
  99 + (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0)
98 100 : unref(getRealWidth);
99 101 return `calc(100% - ${unref(width)}px)`;
100 102 });
... ...
src/layouts/default/sider/MixSider.vue
... ... @@ -15,6 +15,9 @@
15 15 v-bind="getMenuEvents"
16 16 >
17 17 <AppLogo :showTitle="false" :class="`${prefixCls}-logo`" />
  18 +
  19 + <Trigger :class="`${prefixCls}-trigger`" />
  20 +
18 21 <ScrollContainer>
19 22 <ul :class="`${prefixCls}-module`">
20 23 <li
... ... @@ -76,25 +79,30 @@
76 79 </div>
77 80 </template>
78 81 <script lang="ts">
79   - import { defineComponent, onMounted, ref, computed, CSSProperties, unref } from 'vue';
80 82 import type { Menu } from '/@/router/types';
81   - import { RouteLocationNormalized } from 'vue-router';
82   - import { useDesign } from '/@/hooks/web/useDesign';
83   - import { getShallowMenus, getChildrenMenus, getCurrentParentPath } from '/@/router/menus';
84   - import { useI18n } from '/@/hooks/web/useI18n';
  83 + import type { CSSProperties } from 'vue';
  84 + import type { RouteLocationNormalized } from 'vue-router';
  85 +
  86 + import { defineComponent, onMounted, ref, computed, unref } from 'vue';
  87 +
  88 + import { BasicMenu, MenuTag } from '/@/components/Menu';
85 89 import { ScrollContainer } from '/@/components/Container';
86 90 import Icon from '/@/components/Icon';
87 91 import { AppLogo } from '/@/components/Application';
88   - import { useGo } from '/@/hooks/web/usePage';
89   - import { BasicMenu, MenuTag } from '/@/components/Menu';
90   - import { listenerLastChangeTab } from '/@/logics/mitt/tabChange';
  92 + import Trigger from '../trigger/HeaderTrigger.vue';
  93 +
91 94 import { useMenuSetting } from '/@/hooks/setting/useMenuSetting';
92 95 import { useDragLine } from './useLayoutSider';
93 96 import { useGlobSetting } from '/@/hooks/setting';
  97 + import { useDesign } from '/@/hooks/web/useDesign';
  98 + import { useI18n } from '/@/hooks/web/useI18n';
  99 + import { useGo } from '/@/hooks/web/usePage';
94 100  
95 101 import { SIDE_BAR_SHOW_TIT_MINI_WIDTH, SIDE_BAR_MINI_WIDTH } from '/@/enums/appEnum';
96 102  
97 103 import clickOutside from '/@/directives/clickOutside';
  104 + import { getShallowMenus, getChildrenMenus, getCurrentParentPath } from '/@/router/menus';
  105 + import { listenerLastChangeTab } from '/@/logics/mitt/tabChange';
98 106  
99 107 export default defineComponent({
100 108 name: 'LayoutMixSider',
... ... @@ -104,6 +112,7 @@
104 112 BasicMenu,
105 113 MenuTag,
106 114 Icon,
  115 + Trigger,
107 116 },
108 117 directives: {
109 118 clickOutside,
... ... @@ -419,7 +428,7 @@
419 428 }
420 429  
421 430 > .scrollbar {
422   - height: calc(100% - @header-height) !important;
  431 + height: calc(100% - @header-height - 38px);
423 432 }
424 433  
425 434 &.mini &-module {
... ... @@ -468,14 +477,34 @@
468 477 &__icon {
469 478 margin-bottom: 8px;
470 479 font-size: 24px;
  480 + transition: all 0.2s;
471 481 }
472 482  
473 483 &__name {
474 484 margin-bottom: 0;
475 485 font-size: 12px;
  486 + transition: all 0.2s;
476 487 }
477 488 }
478 489  
  490 + &-trigger {
  491 + position: absolute;
  492 + bottom: 0;
  493 + left: 0;
  494 + width: 100%;
  495 + padding: 6px;
  496 + padding-left: 12px;
  497 + font-size: 18px;
  498 + color: rgba(255, 255, 255, 0.65);
  499 + cursor: pointer;
  500 + background: @sider-dark-bg-color;
  501 + }
  502 +
  503 + &.light &-trigger {
  504 + color: rgba(0, 0, 0, 0.65);
  505 + background: #fff;
  506 + }
  507 +
479 508 &-menu-list {
480 509 position: fixed;
481 510 top: 0;
... ... @@ -483,7 +512,7 @@
483 512 width: 200px;
484 513 height: calc(100%);
485 514 background: #fff;
486   - transition: width 0.2s;
  515 + transition: all 0.2s;
487 516 .@{tag-prefix-cls} {
488 517 position: absolute;
489 518 top: 10px;
... ...