From 9bb8e4646e8c4bd7ec38b9b4104b7f40d928629d Mon Sep 17 00:00:00 2001 From: hxr <1490493387@qq.com> Date: Thu, 26 Oct 2023 00:09:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20:bug:=20=E9=BB=98=E8=AE=A4=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E6=98=8E=E4=BA=AE=E6=A8=A1=E5=BC=8F=E6=97=A0=E6=95=88?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/settings.ts | 2 +- src/store/modules/settings.ts | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/settings.ts b/src/settings.ts index a575395..75df0b7 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 04af061..ad58399 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;