From 10745207e64d2d444636cb9d877cec9a0bebf1eb Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Wed, 20 Dec 2023 10:26:51 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E4=B8=BB=E9=A2=98=E8=89=B2=E7=BC=93=E5=AD=98=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/src/App.vue b/src/App.vue index c0976546a..389960e74 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,9 +2,8 @@ import { computed } from 'vue' import { useAppStore } from '@/store/modules/app' import { ConfigGlobal } from '@/components/ConfigGlobal' -import { isDark } from '@/utils/is' import { useDesign } from '@/hooks/web/useDesign' -import { useStorage } from '@/hooks/web/useStorage' +import { useDark } from '@vueuse/core' const { getPrefixCls } = useDesign() @@ -16,19 +15,12 @@ const currentSize = computed(() => appStore.getCurrentSize) const greyMode = computed(() => appStore.getGreyMode) -const { getStorage } = useStorage() +const isDark = useDark({ + valueDark: 'dark', + valueLight: 'light' +}) -// 根据浏览器当前主题设置系统主题色 -const setDefaultTheme = () => { - if (getStorage('isDark') !== null) { - appStore.setIsDark(getStorage('isDark')) - return - } - const isDarkTheme = isDark() - appStore.setIsDark(isDarkTheme) -} - -setDefaultTheme() +isDark.value = appStore.getIsDark