From a97db2754a397db4d8ac78c902f39d1859929823 Mon Sep 17 00:00:00 2001 From: xingyu Date: Wed, 7 Dec 2022 20:40:37 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9A=97=E9=BB=91=E6=A8=A1=E5=BC=8Fbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-ui-admin-vue3/src/App.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/yudao-ui-admin-vue3/src/App.vue b/yudao-ui-admin-vue3/src/App.vue index 353c701ac..476c0c5de 100644 --- a/yudao-ui-admin-vue3/src/App.vue +++ b/yudao-ui-admin-vue3/src/App.vue @@ -15,15 +15,10 @@ const { wsCache } = useCache() // 根据浏览器当前主题设置系统主题色 const setDefaultTheme = () => { - if (wsCache.get(CACHE_KEY.IS_DARK)) { - if (wsCache.get(CACHE_KEY.IS_DARK) || wsCache.get(CACHE_KEY.IS_DARK) === 'true') { - appStore.setIsDark(true) - } else { - appStore.setIsDark(false) - } - return + let isDarkTheme = wsCache.get(CACHE_KEY.IS_DARK) + if (isDarkTheme === null) { + isDarkTheme = isDark() } - const isDarkTheme = isDark() appStore.setIsDark(isDarkTheme) } setDefaultTheme()