diff --git a/themes/medium/components/Catalog.js b/themes/medium/components/Catalog.js index af5e4555..a92123f1 100644 --- a/themes/medium/components/Catalog.js +++ b/themes/medium/components/Catalog.js @@ -28,6 +28,7 @@ const Catalog = ({ toc }) => { const throttleMs = 100 const actionSectionScrollSpy = React.useCallback(throttle(() => { + console.log('滚动') const sections = document.getElementsByClassName('notion-h') let prevBBox = null let currentSectionId = activeSection @@ -51,6 +52,7 @@ const Catalog = ({ toc }) => { } setActiveSection(currentSectionId) const index = tocIds.indexOf(currentSectionId) || 0 + console.log(tRef?.current) tRef?.current?.scrollTo({ top: 28 * index, behavior: 'smooth' }) }, throttleMs)) diff --git a/themes/medium/components/TocDrawer.js b/themes/medium/components/TocDrawer.js index 366f8bc9..9a9270db 100644 --- a/themes/medium/components/TocDrawer.js +++ b/themes/medium/components/TocDrawer.js @@ -18,10 +18,9 @@ const TocDrawer = ({ post, cRef }) => { {/* 侧边菜单 */}