mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-05-14 07:26:52 +00:00
Merge pull request #1186 from tangly1024/feat/theme-switch
dynamic-theme
This commit is contained in:
@@ -18,12 +18,13 @@ export const ALL_THEME = [
|
||||
* @returns
|
||||
*/
|
||||
export const getLayoutByTheme = (router) => {
|
||||
const theme = getQueryParam(router.asPath, 'theme') || BLOG.THEME
|
||||
const themeQuery = getQueryParam(router.asPath, 'theme') || BLOG.THEME
|
||||
const layout = getLayoutNameByPath(router.pathname)
|
||||
if (theme !== BLOG.THEME) {
|
||||
return dynamic(() => import(`@/themes/${theme}/${layout}`), { ssr: true })
|
||||
if (themeQuery !== BLOG.THEME) {
|
||||
// console.log('动态主题', themeQuery, BLOG.THEME)
|
||||
return dynamic(() => import(`@/themes/${themeQuery}/${layout}`), { ssr: true })
|
||||
} else {
|
||||
// console.log('静态主题', layout)
|
||||
// console.log('静态主题', themeQuery, BLOG.THEME)
|
||||
return ThemeComponents[layout]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user