From 68afc8865a87ba1900636dc7ff0de1b587f3456c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=97=A0=E6=9C=A8?= Date: Sat, 2 Jan 2021 16:18:32 +0800 Subject: [PATCH] wip(menu): mixSideTrigger setting --- src/enums/menuEnum.ts | 5 +++++ src/layouts/default/setting/SettingDrawer.tsx | 10 ++++++++++ src/layouts/default/setting/enum.ts | 20 ++++++++++++++++++- src/layouts/default/setting/handler.ts | 3 +++ src/locales/lang/en/layout/setting.ts | 4 ++++ src/locales/lang/zh_CN/layout/setting.ts | 4 ++++ src/settings/projectSetting.ts | 4 ++-- src/types/config.d.ts | 4 ++-- 8 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/enums/menuEnum.ts b/src/enums/menuEnum.ts index 11fb946f0fe..89cfa9f5c30 100644 --- a/src/enums/menuEnum.ts +++ b/src/enums/menuEnum.ts @@ -43,3 +43,8 @@ export enum TopMenuAlignEnum { START = 'start', END = 'end', } + +export enum MixSidebarTriggerEnum { + HOVER = 'hover', + CLICK = 'click', +} diff --git a/src/layouts/default/setting/SettingDrawer.tsx b/src/layouts/default/setting/SettingDrawer.tsx index f78634ff885..cd4b68b0079 100644 --- a/src/layouts/default/setting/SettingDrawer.tsx +++ b/src/layouts/default/setting/SettingDrawer.tsx @@ -28,6 +28,7 @@ import { getMenuTriggerOptions, routerTransitionOptions, menuTypeList, + mixSidebarTriggerOptions, } from './enum'; import { HEADER_PRESET_BG_COLOR_LIST, SIDE_BAR_BG_COLOR_LIST } from '/@/settings/colorSetting'; @@ -73,6 +74,7 @@ export default defineComponent({ getSplit, getIsMixSidebar, getCloseMixSidebarOnChange, + getMixSideTrigger, } = useMenuSetting(); const { @@ -115,6 +117,14 @@ export default defineComponent({ def={unref(getCloseMixSidebarOnChange)} disabled={!unref(getIsMixSidebar)} /> + + ); } diff --git a/src/layouts/default/setting/enum.ts b/src/layouts/default/setting/enum.ts index d4ab8b40ae4..41e78e43e3f 100644 --- a/src/layouts/default/setting/enum.ts +++ b/src/layouts/default/setting/enum.ts @@ -1,5 +1,11 @@ import { ContentEnum, RouterTransitionEnum } from '/@/enums/appEnum'; -import { MenuModeEnum, MenuTypeEnum, TopMenuAlignEnum, TriggerEnum } from '/@/enums/menuEnum'; +import { + MenuModeEnum, + MenuTypeEnum, + TopMenuAlignEnum, + TriggerEnum, + MixSidebarTriggerEnum, +} from '/@/enums/menuEnum'; import { useI18n } from '/@/hooks/web/useI18n'; @@ -20,6 +26,7 @@ export enum HandlerEnum { MENU_SPLIT, MENU_FIXED, MENU_CLOSE_MIX_SIDEBAR_ON_CHANGE, + MENU_TRIGGER_MIX_SIDEBAR, // header HEADER_SHOW, @@ -132,3 +139,14 @@ export const menuTypeList = [ type: MenuTypeEnum.MIX_SIDEBAR, }, ]; + +export const mixSidebarTriggerOptions = [ + { + value: MixSidebarTriggerEnum.HOVER, + label: t('layout.setting.triggerHover'), + }, + { + value: MixSidebarTriggerEnum.CLICK, + label: t('layout.setting.triggerClick'), + }, +]; diff --git a/src/layouts/default/setting/handler.ts b/src/layouts/default/setting/handler.ts index 7e034c283c9..84c6124d2f7 100644 --- a/src/layouts/default/setting/handler.ts +++ b/src/layouts/default/setting/handler.ts @@ -67,6 +67,9 @@ export function handler(event: HandlerEnum, value: any): DeepPartial