feat:增加 wot 集成(额外),参考 unibest 3.X 代码

This commit is contained in:
YunaiV
2025-12-12 19:13:05 +08:00
parent abad67d5d0
commit 3acee68ab9
5 changed files with 67 additions and 7 deletions

42
src/store/theme.ts Normal file
View File

@@ -0,0 +1,42 @@
import type { ConfigProviderThemeVars } from 'wot-design-uni'
import { defineStore } from 'pinia'
export const useThemeStore = defineStore(
'theme-store',
() => {
/** 主题 */
const theme = ref<'light' | 'dark'>('light')
/** 主题变量 */
const themeVars = ref<ConfigProviderThemeVars>({
// colorTheme: 'red',
// buttonPrimaryBgColor: '#07c160',
// buttonPrimaryColor: '#07c160',
})
/** 设置主题变量 */
const setThemeVars = (partialVars: Partial<ConfigProviderThemeVars>) => {
themeVars.value = { ...themeVars.value, ...partialVars }
}
/** 切换主题 */
const toggleTheme = () => {
theme.value = theme.value === 'light' ? 'dark' : 'light'
}
return {
/** 设置主题变量 */
setThemeVars,
/** 切换主题 */
toggleTheme,
/** 主题变量 */
themeVars,
/** 主题 */
theme,
}
},
{
persist: true,
},
)