From 9d9859e512f93b45c692df1f01b03230b706baf6 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Thu, 22 Jun 2023 21:49:16 +0800 Subject: [PATCH] dynamic-theme --- themes/theme.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/themes/theme.js b/themes/theme.js index 6c75c046..792cf1d1 100644 --- a/themes/theme.js +++ b/themes/theme.js @@ -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] } }