gitbook 延时展开侧边分组

This commit is contained in:
tangly1024.com
2024-04-26 09:38:35 +08:00
parent 4859dff2c9
commit e51f794949

View File

@@ -61,10 +61,12 @@ const NavPostList = props => {
// 如果都没有选中默认打开第一个 // 如果都没有选中默认打开第一个
useEffect(() => { useEffect(() => {
if (expandedGroups.length === 0) { setTimeout(() => {
setExpandedGroups([0]) if (expandedGroups.length === 0) {
} setExpandedGroups([0])
}, []) }
}, 500)
}, [router])
// 折叠项切换,当折叠或展开数组时会调用 // 折叠项切换,当折叠或展开数组时会调用
const toggleItem = index => { const toggleItem = index => {