From 021ea08f47e6ceaec7b4e46712bbb0d13387da12 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 10 May 2024 15:33:33 +0800 Subject: [PATCH] gitbook url selected decode --- themes/gitbook/components/BlogPostCard.js | 4 +++- themes/gitbook/components/NavPostList.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/themes/gitbook/components/BlogPostCard.js b/themes/gitbook/components/BlogPostCard.js index 3528512a..72755672 100644 --- a/themes/gitbook/components/BlogPostCard.js +++ b/themes/gitbook/components/BlogPostCard.js @@ -7,7 +7,9 @@ import CONFIG from '../config' const BlogPostCard = ({ post, className }) => { const router = useRouter() - const currentSelected = router.asPath.split('?')[0] === post?.href + const currentSelected = + decodeURIComponent(router.asPath.split('?')[0]) === post?.href + return (
{ // 默认展开一个 const defaultOpenIndex = getDefaultOpenIndexByPath( categoryFolders, - router.asPath.split('?')[0] + decodeURIComponent(router.asPath.split('?')[0]) ) setExpandedGroups([defaultOpenIndex]) }, 500)