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