Commit a0fdceeae7e25049eef6dc7dc920876f02329c3c
1 parent
c6e5c0f5
fix: 修复边栏无法打开问题,deepMerge函数有问题未修复
Showing
2 changed files
with
5 additions
and
3 deletions
src/hooks/setting/useMenuSetting.ts
... | ... | @@ -123,7 +123,7 @@ export function useMenuSetting() { |
123 | 123 | |
124 | 124 | // Set menu configuration |
125 | 125 | function setMenuSetting(menuSetting: Partial<MenuSetting>): void { |
126 | - appStore.setProjectConfig({ menuSetting }); | |
126 | + appStore.setMenuSetting(menuSetting); | |
127 | 127 | } |
128 | 128 | |
129 | 129 | function toggleCollapsed() { |
... | ... | @@ -133,9 +133,7 @@ export function useMenuSetting() { |
133 | 133 | } |
134 | 134 | return { |
135 | 135 | setMenuSetting, |
136 | - | |
137 | 136 | toggleCollapsed, |
138 | - | |
139 | 137 | getMenuFixed, |
140 | 138 | getRealWidth, |
141 | 139 | getMenuType, |
... | ... |
src/store/modules/app.ts
... | ... | @@ -82,6 +82,10 @@ export const useAppStore = defineStore({ |
82 | 82 | this.projectConfig = deepMerge(this.projectConfig || {}, config); |
83 | 83 | Persistent.setLocal(PROJ_CFG_KEY, this.projectConfig); |
84 | 84 | }, |
85 | + setMenuSetting(setting: Partial<MenuSetting>): void { | |
86 | + this.projectConfig.menuSetting = deepMerge(this.projectConfig.menuSetting, setting); | |
87 | + Persistent.setLocal(PROJ_CFG_KEY, this.projectConfig); | |
88 | + }, | |
85 | 89 | |
86 | 90 | async resetAllState() { |
87 | 91 | resetRouter(); |
... | ... |