mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26: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
|
||||
|
||||
@@ -278,7 +278,7 @@ async function getDataBaseInfoByNotionAPI({ pageId, from }) {
|
||||
if (pageIds?.length === 0) {
|
||||
console.error('获取到的文章列表为空,请检查notion模板', collectionQuery, collection, collectionView, viewIds, pageRecordMap)
|
||||
} else {
|
||||
console.log('有效Page数量', pageIds?.length)
|
||||
// console.log('有效Page数量', pageIds?.length)
|
||||
}
|
||||
|
||||
// 获取每篇文章基础数据
|
||||
|
||||
@@ -14,13 +14,13 @@ export const { THEMES = [] } = getConfig().publicRuntimeConfig
|
||||
* @returns
|
||||
*/
|
||||
export const getGlobalLayoutByTheme = (themeQuery) => {
|
||||
const layout = getLayoutNameByPath(-1)
|
||||
if (themeQuery !== BLOG.THEME) {
|
||||
return dynamic(() => import(`@/themes/${themeQuery}`).then(m => m[layout]), { ssr: true })
|
||||
} else {
|
||||
return ThemeComponents[layout]
|
||||
}
|
||||
const layout = getLayoutNameByPath(-1)
|
||||
if (themeQuery !== BLOG.THEME) {
|
||||
return dynamic(() => import(`@/themes/${themeQuery}`).then(m => m[layout]), { ssr: true })
|
||||
} else {
|
||||
return ThemeComponents[layout]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载主题文件
|
||||
@@ -71,7 +71,7 @@ const checkThemeDOM = () => {
|
||||
export const getLayoutNameByPath = (path) => {
|
||||
switch (path) {
|
||||
case -1:
|
||||
return 'LayoutBase'
|
||||
return 'LayoutBase'
|
||||
case '/':
|
||||
return 'LayoutIndex'
|
||||
case '/archive':
|
||||
|
||||
Reference in New Issue
Block a user