diff --git a/src/settings.ts b/src/settings.ts index a575395e..75df0b7a 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -54,7 +54,7 @@ const defaultSettings: DefaultSettings = { fixedHeader: false, sidebarLogo: true, layout: "left", // 默认左侧模式 - theme: "light", // 默认暗黑模式 + theme: "light", // 暗黑模式-dark 明亮模式-light size: "default", language: "zh-cn", themeColor: "#409EFF", diff --git a/src/store/modules/settings.ts b/src/store/modules/settings.ts index 04af061d..ad583995 100644 --- a/src/store/modules/settings.ts +++ b/src/store/modules/settings.ts @@ -18,6 +18,11 @@ export const useSettingsStore = defineStore("setting", () => { "themeColor", defaultSettings.themeColor ); + + const theme = useStorage("theme", defaultSettings.theme); + if (theme.value == "light") { + document.body.classList.remove("dark"); + } // actions function changeSetting(param: { key: string; value: any }) { const { key, value } = param;