fix: useTheme use single ref (#21)
This commit is contained in:
parent
f3fd669cad
commit
12cb7cfcc3
@ -9,8 +9,6 @@ interface IThemeList {
|
||||
/** 注册的主题名称, 其中 normal 是必填的 */
|
||||
export type ThemeName = "normal" | "dark"
|
||||
|
||||
/** 主题 hook */
|
||||
export function useTheme() {
|
||||
/** 主题列表 */
|
||||
const themeList: IThemeList[] = [
|
||||
{
|
||||
@ -22,6 +20,7 @@ export function useTheme() {
|
||||
name: "dark"
|
||||
}
|
||||
]
|
||||
|
||||
/** 正在应用的主题名称 */
|
||||
const activeThemeName = ref<ThemeName>(getActiveThemeName() || "normal")
|
||||
|
||||
@ -40,5 +39,7 @@ export function useTheme() {
|
||||
document.documentElement.className = value
|
||||
}
|
||||
|
||||
/** 主题 hook */
|
||||
export function useTheme() {
|
||||
return { themeList, activeThemeName, initTheme, setTheme }
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user