import { useGlobal } from '@/lib/global' import * as ThemeMap from '@/themes' import { useState } from 'react' /** * * @returns 调试面板 */ export function DebugButton () { const [show, setShow] = useState(false) const GlobalConfig = useGlobal() const { theme, setTheme } = GlobalConfig const allThemes = Object.keys(ThemeMap) function toggleShow () { setShow(!show) } /** * 切换主题 */ function changeTheme () { const currentIndex = allThemes.indexOf(theme) const newIndex = currentIndex < allThemes.length - 1 ? currentIndex + 1 : 0 setTheme(allThemes[newIndex]) } return <>
当前主题:
{theme}
所有主题:
{allThemes.join(',')}
更换主题
所有配置:

{JSON.stringify(GlobalConfig)}

调试按钮
}