切换主题

This commit is contained in:
tangly1024
2023-06-19 22:50:12 +08:00
parent 9759f8fb50
commit 16bdf3a745
3 changed files with 34 additions and 36 deletions

View File

@@ -15,7 +15,9 @@ const ThemeSwitch = () => {
// 例如 http://localhost?theme=hexo 跳转到 http://localhost?theme=newTheme
const onSelectChange = (e) => {
const newTheme = e.target.value
const query = { ...router.query, theme: newTheme }
const query = router.query
query.theme = newTheme
console.log('切换主题', newTheme)
router.push({ pathname: router.pathname, query })
}