From 48462a4ed1bfe225320efd5e5374fdc4163f54ff Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Sat, 11 May 2024 14:00:09 +0800 Subject: [PATCH] =?UTF-8?q?matery=20=E4=B8=BB=E9=A2=98=E5=B7=B2=E7=9F=A5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8Fbug=E4=BF=AE=E5=A4=8D=EF=BC=8C=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E9=80=8F=E6=98=8E=E8=89=B2=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/matery/components/Header.js | 4 +- themes/matery/index.js | 72 ++++++++++++++---------------- 2 files changed, 37 insertions(+), 39 deletions(-) diff --git a/themes/matery/components/Header.js b/themes/matery/components/Header.js index 4df222c5..d6c195f8 100644 --- a/themes/matery/components/Header.js +++ b/themes/matery/components/Header.js @@ -3,6 +3,7 @@ import { siteConfig } from '@/lib/config' import { useGlobal } from '@/lib/global' import throttle from 'lodash.throttle' import Link from 'next/link' +import { useRouter } from 'next/router' import { useCallback, useEffect, useRef, useState } from 'react' import CONFIG from '../config' import CategoryGroup from './CategoryGroup' @@ -28,6 +29,7 @@ const Header = props => { const throttleMs = 200 const showSearchButton = siteConfig('MATERY_MENU_SEARCH', false, CONFIG) + const router = useRouter() const scrollTrigger = useCallback( throttle(() => { requestAnimationFrame(() => { @@ -85,7 +87,7 @@ const Header = props => { return () => { window.removeEventListener('scroll', scrollTrigger) } - }, []) + }, [router]) const [isOpen, changeShow] = useState(false) diff --git a/themes/matery/index.js b/themes/matery/index.js index 8889b6a8..9f642cab 100644 --- a/themes/matery/index.js +++ b/themes/matery/index.js @@ -201,7 +201,7 @@ const LayoutArchive = props => { const { archivePosts } = props return ( <> - +
{Object.keys(archivePosts).map(archiveTitle => ( { const { categoryOptions } = props return ( - <> -
-
-
- {categoryOptions?.map(e => { - return ( - -
- {e.name}({e.count}) -
- - ) - })} -
+
+
+
+ {categoryOptions?.map(e => { + return ( + +
+ {e.name}({e.count}) +
+ + ) + })}
- +
) } @@ -388,27 +386,25 @@ const LayoutTagIndex = props => { const { tagOptions } = props const { locale } = useGlobal() return ( - <> -
-
-
- {locale.COMMON.TAGS} -
+
+
+
+ {locale.COMMON.TAGS} +
-
- {tagOptions.map(tag => { - return ( -
- -
- ) - })} -
+
+ {tagOptions.map(tag => { + return ( +
+ +
+ ) + })}
- +
) }