From 801898d1765da2583b02643c7f2e3e3204d1c083 Mon Sep 17 00:00:00 2001 From: real-jacket <1762982273@qq.com> Date: Thu, 7 Sep 2023 22:00:08 +0800 Subject: [PATCH] =?UTF-8?q?style(heo):=20=E4=BF=AE=E5=A4=8D=E5=9C=A8?= =?UTF-8?q?=E8=BE=83=E5=B0=8F=E5=B1=8F=E5=B9=95=E5=B0=BA=E5=AF=B8=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E6=96=87=E7=AB=A0=E5=AE=BD=E5=BA=A6=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/heo/index.js | 43 +++++++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/themes/heo/index.js b/themes/heo/index.js index 01f23a27bb6..778fbb48f34 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 && (