mirror of
https://github.com/d0zingcat/NotionNext.git
synced 2026-06-06 15:10:29 +00:00
修改布局
This commit is contained in:
@@ -6,6 +6,22 @@ import getConfig from 'next/config'
|
||||
import * as ThemeComponents from '@theme-components'
|
||||
// 所有主题在next.config.js中扫描
|
||||
export const { THEMES = [] } = getConfig().publicRuntimeConfig
|
||||
|
||||
/**
|
||||
* 加载全局布局
|
||||
* 如果是
|
||||
* @param {*} themeQuery
|
||||
* @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]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载主题文件
|
||||
* 如果是
|
||||
@@ -54,6 +70,8 @@ const checkThemeDOM = () => {
|
||||
*/
|
||||
export const getLayoutNameByPath = (path) => {
|
||||
switch (path) {
|
||||
case -1:
|
||||
return 'LayoutBase'
|
||||
case '/':
|
||||
return 'LayoutIndex'
|
||||
case '/archive':
|
||||
|
||||
Reference in New Issue
Block a user