From 477a658645d558130709c4b707ed5f26a17602a1 Mon Sep 17 00:00:00 2001 From: xingyu Date: Sat, 17 Jun 2023 18:57:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=BE=B9=E6=A0=8F?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E6=89=93=E5=BC=80=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?deepMerge=E5=87=BD=E6=95=B0=E6=9C=89=E9=97=AE=E9=A2=98=E6=9C=AA?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/setting/useMenuSetting.ts | 2 +- src/store/modules/app.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hooks/setting/useMenuSetting.ts b/src/hooks/setting/useMenuSetting.ts index bf8a2f8f..27ddae3d 100644 --- a/src/hooks/setting/useMenuSetting.ts +++ b/src/hooks/setting/useMenuSetting.ts @@ -108,7 +108,7 @@ export function useMenuSetting() { // Set menu configuration function setMenuSetting(menuSetting: Partial): void { - appStore.setProjectConfig({ menuSetting }) + appStore.setMenuSetting(menuSetting) } function toggleCollapsed() { diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts index c45a1f93..e70b1527 100644 --- a/src/store/modules/app.ts +++ b/src/store/modules/app.ts @@ -85,6 +85,11 @@ export const useAppStore = defineStore('app', { Persistent.setLocal(PROJ_CFG_KEY, this.projectConfig) }, + setMenuSetting(setting: Partial): void { + this.projectConfig.menuSetting = deepMerge(this.projectConfig.menuSetting, setting) + Persistent.setLocal(PROJ_CFG_KEY, this.projectConfig) + }, + async resetAllState() { resetRouter() Persistent.clearAll()