feat(app-store): 添加主题模式类型定义和初始值配置
All checks were successful
CI/CD Pipeline / playwright (push) Successful in 2m9s
CI/CD Pipeline / build-and-deploy (push) Successful in 2m31s

更新 useColorMode 钩子的类型参数,明确指定为 BasicColorSchema 类型,
并设置 initialValue 为 'auto',确保主题模式的类型安全和默认行为。
同时添加 attribute 配置项以支持 class 属性切换。
This commit is contained in:
严浩
2025-11-05 13:45:15 +08:00
parent 4b645bb916
commit 2ba453bbed

View File

@@ -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<BasicColorSchema>({
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,