diff --git a/lib/global.js b/lib/global.js index b5d76d83..5039b9f2 100644 --- a/lib/global.js +++ b/lib/global.js @@ -31,6 +31,7 @@ export function GlobalContextProvider(props) { ) // 默认语言 const [theme, setTheme] = useState(NOTION_CONFIG?.THEME || THEME) // 默认博客主题 const [THEME_CONFIG, SET_THEME_CONFIG] = useState(null) // 主题配置 + const [isLiteMode,setLiteMode] = useState(false) const defaultDarkMode = NOTION_CONFIG?.APPEARANCE || APPEARANCE const [isDarkMode, updateDarkMode] = useState(defaultDarkMode === 'dark') // 默认深色模式 @@ -107,6 +108,9 @@ export function GlobalContextProvider(props) { const newUrl = `${url}${url.includes('?') ? '&' : '?'}theme=${themeStr}` router.push(newUrl) } + if (router.query.lite && router.query.lite==='true') { + setLiteMode(true) + } if (!onLoading) { setOnLoading(true) } @@ -134,6 +138,7 @@ export function GlobalContextProvider(props) { return ( { - const { children } = props + const { children } = props + // 极简模式,会隐藏掉页头页脚等组件,便于嵌入网页等功能 + const { isLiteMode } = useGlobal() + const router = useRouter() - // 加载wow动画 - useEffect(() => { - loadWowJS() - }, []) + // 加载wow动画 + useEffect(() => { + loadWowJS() + }, []) - return ( -
-