From 589007a22a0c6cf44577b1c17c317575d40f1310 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 28 Jan 2025 07:32:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=BB=E9=A2=98=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E9=80=BB=E8=BE=91=EF=BC=8C=E7=AE=80=E5=8C=96=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/App.vue b/src/App.vue index 5f351581..17a0d260 100644 --- a/src/App.vue +++ b/src/App.vue @@ -3,14 +3,11 @@ import { useTheme } from 'vuetify' import { checkPrefersColorSchemeIsDark } from '@/@core/utils' import { ensureRenderComplete, removeEl } from './@core/utils/dom' -const { global: globalTheme } = useTheme() - // 生效主题 -async function setTheme() { - let themeValue = localStorage.getItem('theme') || 'light' - const autoTheme = checkPrefersColorSchemeIsDark() ? 'dark' : 'light' - globalTheme.name.value = themeValue === 'auto' ? autoTheme : themeValue -} +const { global: globalTheme } = useTheme() +let themeValue = localStorage.getItem('theme') || 'light' +const autoTheme = checkPrefersColorSchemeIsDark() ? 'dark' : 'light' +globalTheme.name.value = themeValue === 'auto' ? autoTheme : themeValue // ApexCharts 全局配置 declare global { @@ -43,7 +40,6 @@ if (window.Apex) { } onMounted(() => { - setTheme() ensureRenderComplete(() => { nextTick(() => { setTimeout(() => {