From e51f794949ff7d7bbae4c8ddd44ab500fec3d260 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Fri, 26 Apr 2024 09:38:35 +0800 Subject: [PATCH] =?UTF-8?q?gitbook=20=E5=BB=B6=E6=97=B6=E5=B1=95=E5=BC=80?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E5=88=86=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/gitbook/components/NavPostList.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/themes/gitbook/components/NavPostList.js b/themes/gitbook/components/NavPostList.js index 2c7fceff..be84e9ba 100644 --- a/themes/gitbook/components/NavPostList.js +++ b/themes/gitbook/components/NavPostList.js @@ -61,10 +61,12 @@ const NavPostList = props => { // 如果都没有选中默认打开第一个 useEffect(() => { - if (expandedGroups.length === 0) { - setExpandedGroups([0]) - } - }, []) + setTimeout(() => { + if (expandedGroups.length === 0) { + setExpandedGroups([0]) + } + }, 500) + }, [router]) // 折叠项切换,当折叠或展开数组时会调用 const toggleItem = index => {