From c3379e97378b650886b237f50cf0b3e5a9ab9498 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Mon, 21 Apr 2025 13:14:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A2=98=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E5=8A=9F=E8=83=BD=EF=BC=9A=E4=BF=AE=E6=AD=A3=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E4=BF=9D=E5=AD=98=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE?= =?UTF-8?q?=E4=BF=9D=E4=BF=9D=E5=AD=98=E5=8E=9F=E5=A7=8B=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E8=80=8C=E9=9D=9E=E8=AE=A1=E7=AE=97=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E5=80=BC=EF=BC=9B=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8C=E7=AE=80=E5=8C=96=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E6=8F=90=E5=8D=87=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/@core/components/ThemeSwitcher.vue | 13 +++++-------- src/layouts/components/HeaderTab.vue | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/@core/components/ThemeSwitcher.vue b/src/@core/components/ThemeSwitcher.vue index 86daaf24..3e4cfd2c 100644 --- a/src/@core/components/ThemeSwitcher.vue +++ b/src/@core/components/ThemeSwitcher.vue @@ -41,9 +41,10 @@ function updateTheme() { const autoTheme = checkPrefersColorSchemeIsDark() ? 'dark' : 'light' const theme = currentThemeName.value === 'auto' ? autoTheme : currentThemeName.value globalTheme.name.value = theme - savedTheme.value = theme + // 保存原始主题设置,而不是计算后的值 + savedTheme.value = currentThemeName.value // 保存主题到本地 - saveLocalTheme(theme, globalTheme) + saveLocalTheme(currentThemeName.value, globalTheme) // 刷新页面 location.reload() } @@ -59,7 +60,7 @@ function changeTheme(theme: string) { theme: nextTheme, }) } catch (e) { - console.error('保存主题到服务端失败') + console.error(e) } } @@ -135,11 +136,7 @@ onMounted(() => { - - - 主题选择 - - +
{ })