From 7938a844bfbaa148c341381a05f5fa2c1bbfdc91 Mon Sep 17 00:00:00 2001 From: likui628 <90845831+likui628@users.noreply.github.com> Date: Fri, 17 Nov 2023 22:11:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(layouts):=20SwitchItem=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E4=BC=A0=E5=85=A5callback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/setting/components/Content.vue | 61 +++++++++++-------- .../setting/components/Features.vue | 57 ++++++++++------- .../setting/components/SwitchItem.vue | 20 +++--- .../setting/components/ThemeEditor.vue | 8 +-- .../setting/components/ThemeSwitch.vue | 39 ------------ .../setting/components/Transitions.vue | 21 ++++--- 6 files changed, 97 insertions(+), 109 deletions(-) delete mode 100644 packages/layouts/src/components/setting/components/ThemeSwitch.vue diff --git a/packages/layouts/src/components/setting/components/Content.vue b/packages/layouts/src/components/setting/components/Content.vue index b2662649..6022befe 100644 --- a/packages/layouts/src/components/setting/components/Content.vue +++ b/packages/layouts/src/components/setting/components/Content.vue @@ -8,6 +8,11 @@ import { useHeaderSetting, useMultipleTabSetting, } from '@vben/hooks' + +import { context } from '../../../../bridge' +const { useAppConfig } = context +const { baseHandler } = useAppConfig() + const { t } = useI18n() const { @@ -26,80 +31,86 @@ const { getShowHeader } = useHeaderSetting() const { getShowMultipleTab, getShowQuick, getShowRedo, getShowFold } = useMultipleTabSetting() + +const eventHandler = (evt: HandlerSettingEnum, val: boolean) => { + baseHandler(evt, val) +} diff --git a/packages/layouts/src/components/setting/components/Features.vue b/packages/layouts/src/components/setting/components/Features.vue index 7173587a..b9076a2e 100644 --- a/packages/layouts/src/components/setting/components/Features.vue +++ b/packages/layouts/src/components/setting/components/Features.vue @@ -19,7 +19,8 @@ import { useI18n } from '@vben/locale' const { t } = useI18n() -const { useMenuSetting, useHeaderSetting, useRootSetting } = context +const { useMenuSetting, useHeaderSetting, useRootSetting, useAppConfig } = + context const { getContentMode, getLockTime } = useRootSetting() @@ -59,73 +60,85 @@ const some = triggerOptions.some((item) => item.value === unref(getTrigger)) if (!some) { setMenuSetting({ trigger: TriggerEnum.FOOTER }) } + +const { baseHandler } = useAppConfig() +const eventHandler = (evt: HandlerSettingEnum, val: boolean) => { + baseHandler(evt, val) +}