hook-checks

This commit is contained in:
tangly1024
2022-12-15 13:50:24 +08:00
parent 606b5df0ca
commit 9f44833a68

View File

@@ -11,10 +11,6 @@ import Progress from './Progress'
* @constructor
*/
const Toc = ({ toc }) => {
// 无目录就直接返回空
if (!toc || toc.length < 1) {
return <></>
}
// 监听滚动事件
React.useEffect(() => {
window.addEventListener('scroll', actionSectionScrollSpy)
@@ -58,6 +54,11 @@ const Toc = ({ toc }) => {
tRef?.current?.scrollTo({ top: 28 * index, behavior: 'smooth' })
}, throttleMs))
// 无目录就直接返回空
if (!toc || toc.length < 1) {
return <></>
}
return <div className='px-3'>
<div className='w-full pb-1'>
<Progress />