fix(projects):fixed the issue where switching the layout mode from mobile to vertical would not restore the user-defined layout mode.

This commit is contained in:
lan 2024-03-25 00:14:45 +08:00
parent c11d56da29
commit 9fd5d922ac
2 changed files with 6 additions and 2 deletions

View File

@ -82,10 +82,12 @@ export const useAppStore = defineStore(SetupStoreId.App, () => {
watch( watch(
isMobile, isMobile,
newValue => { newValue => {
setSiderCollapse(newValue);
if (newValue) { if (newValue) {
setSiderCollapse(true); themeStore.layout.userMode = themeStore.layout.mode;
themeStore.setThemeLayout('vertical'); themeStore.setThemeLayout('vertical');
} else {
themeStore.setThemeLayout(themeStore.layout.userMode);
} }
}, },
{ immediate: true } { immediate: true }

View File

@ -28,6 +28,8 @@ declare namespace App {
layout: { layout: {
/** Layout mode */ /** Layout mode */
mode: UnionKey.ThemeLayoutMode; mode: UnionKey.ThemeLayoutMode;
/** User Config mode */
userMode: UnionKey.ThemeLayoutMode;
/** Scroll mode */ /** Scroll mode */
scrollMode: UnionKey.ThemeScrollMode; scrollMode: UnionKey.ThemeScrollMode;
}; };