mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-30 23:16:52 +00:00
宠物主题切换
This commit is contained in:
@@ -25,10 +25,11 @@ export function GlobalContextProvider(props) {
|
||||
|
||||
// 切换主题
|
||||
function switchTheme() {
|
||||
const currentIndex = THEMES.indexOf(theme)
|
||||
const query = router.query
|
||||
const currentTheme = query.theme || theme
|
||||
const currentIndex = THEMES.indexOf(currentTheme)
|
||||
const newIndex = currentIndex < THEMES.length - 1 ? currentIndex + 1 : 0
|
||||
const newTheme = THEMES[newIndex]
|
||||
const query = router.query
|
||||
query.theme = newTheme
|
||||
router.push({ pathname: router.pathname, query })
|
||||
return newTheme
|
||||
|
||||
Reference in New Issue
Block a user