From 2ba453bbed02e6e66193df37039566d3d009cf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=A5=E6=B5=A9?= Date: Wed, 5 Nov 2025 13:45:15 +0800 Subject: [PATCH] =?UTF-8?q?feat(app-store):=20=E6=B7=BB=E5=8A=A0=E4=B8=BB?= =?UTF-8?q?=E9=A2=98=E6=A8=A1=E5=BC=8F=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E5=92=8C=E5=88=9D=E5=A7=8B=E5=80=BC=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新 useColorMode 钩子的类型参数,明确指定为 BasicColorSchema 类型, 并设置 initialValue 为 'auto',确保主题模式的类型安全和默认行为。 同时添加 attribute 配置项以支持 class 属性切换。 --- src/stores/app-store-auto-imports.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/stores/app-store-auto-imports.ts b/src/stores/app-store-auto-imports.ts index 309986b..a54acfd 100644 --- a/src/stores/app-store-auto-imports.ts +++ b/src/stores/app-store-auto-imports.ts @@ -1,13 +1,16 @@ +import type { BasicColorSchema } from '@vueuse/core'; import { useLocalStorage, useMediaQuery } from '@vueuse/core'; import { defineStore } from 'pinia'; import { computed } from 'vue'; // >>>>> // https://vueuse.org/core/useColorMode/#advanced-usage -const { system, store: themeMode } = useColorMode({ +const { system, store: themeMode } = useColorMode({ selector: 'html', + attribute: 'class', modes: { light: '', dark: 'app-dark', auto: '' }, disableTransition: false, + initialValue: 'auto', }); const { state, next: cycleTheme } = useCycleList(['light', 'dark', 'auto'] as const, { initialValue: themeMode,