diff --git a/themes/heo/index.js b/themes/heo/index.js index 01f23a27..778fbb48 100644 --- a/themes/heo/index.js +++ b/themes/heo/index.js @@ -1,7 +1,7 @@ import CONFIG from './config' import CommonHead from '@/components/CommonHead' -import { useEffect } from 'react' +import { useEffect, useState } from 'react' import Footer from './components/Footer' import SideRight from './components/SideRight' import NavBar from './components/NavBar' @@ -123,11 +123,13 @@ const LayoutIndex = props => {
{/* 文章分类条 */} - {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
) @@ -155,11 +157,13 @@ const LayoutPostList = props => {
{/* 文章分类条 */} - {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
) @@ -206,17 +210,21 @@ const LayoutSearch = props => { headerSlot={headerSlot} >
- {!currentSearch ? ( + {!currentSearch + ? ( - ) : ( + ) + : (
- {BLOG.POST_LIST_STYLE === 'page' ? ( + {BLOG.POST_LIST_STYLE === 'page' + ? ( - ) : ( + ) + : ( - )} + )}
- )} + )}
) @@ -272,6 +280,13 @@ const LayoutSlug = props => { const { post, lock, validPassword } = props const { locale } = useGlobal() + const [hasCode, setHasCode] = useState(false) + + useEffect(() => { + const hasCode = document.querySelectorAll('[class^="language-"]').length > 0 + setHasCode(hasCode) + }, []) + // 右侧栏 const slotRight = const headerSlot = ( @@ -298,7 +313,7 @@ const LayoutSlug = props => { showTag={false} slotRight={slotRight} > -
+
{lock && } {!lock && (