dynamic-theme

This commit is contained in:
tangly1024
2023-06-22 21:49:16 +08:00
parent 59f9d9e730
commit 9d9859e512

View File

@@ -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]
}
}