gitbook url selected decode

This commit is contained in:
tangly1024.com
2024-05-10 15:33:33 +08:00
parent 2da448f4f8
commit 021ea08f47
2 changed files with 4 additions and 2 deletions

View File

@@ -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 (
<Link href={post?.href} passHref>
<div

View File

@@ -36,7 +36,7 @@ const NavPostList = props => {
// 默认展开一个
const defaultOpenIndex = getDefaultOpenIndexByPath(
categoryFolders,
router.asPath.split('?')[0]
decodeURIComponent(router.asPath.split('?')[0])
)
setExpandedGroups([defaultOpenIndex])
}, 500)