diff --git a/src/config/index.ts b/src/config/index.ts index f86abea3..945dbcd9 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -2,4 +2,7 @@ import * as localeConfig from './locale'; import loginConfig from './login'; import themeConfig from './theme'; const settingKey = 'me-config'; -export { loginConfig, localeConfig, themeConfig, settingKey }; +const settingConfig = { + openKeepAlive: true, // 是否开启KeepAlive缓存 +}; +export { loginConfig, localeConfig, themeConfig, settingKey, settingConfig }; diff --git a/src/layout/components/page.vue b/src/layout/components/page.vue index 745c836b..99901ecc 100644 --- a/src/layout/components/page.vue +++ b/src/layout/components/page.vue @@ -13,25 +13,28 @@ diff --git a/src/store/modules/setting.ts b/src/store/modules/setting.ts index e084b096..d626f35b 100644 --- a/src/store/modules/setting.ts +++ b/src/store/modules/setting.ts @@ -5,7 +5,7 @@ import { mixColor } from '@/utils/helper'; const { css } = useStyleTag(''); const useSettingStore = defineStore('setting', { state: () => ({ - themeConfig: useStorage(`${settingKey}-theme`, themeConfig), + themeConfig: useStorage(`${settingKey}-theme`, themeConfig, localStorage, { mergeDefaults: true }), locale: useStorage(`${settingKey}-locale`, localeConfig.localeSetting.locale ?? 'zh-cn'), elLocale: undefined as Language | undefined, isDark: useDark({ storageKey: 'me-color-dark-scheme' }), diff --git a/src/views/dashboard/index.vue b/src/views/dashboard/index.vue index f5ce8481..9529dab5 100644 --- a/src/views/dashboard/index.vue +++ b/src/views/dashboard/index.vue @@ -6,4 +6,11 @@