From 74c88c748cd19005bb2968775bdc28ccc514dbac Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 8 Feb 2023 17:04:59 +0800 Subject: [PATCH] =?UTF-8?q?toc=20=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- themes/medium/components/Catalog.js | 2 ++ themes/medium/components/TocDrawer.js | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) 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 }) => { {/* 侧边菜单 */}
+ ' overflow-y-hidden shadow-card w-60 duration-200 fixed right-1 bottom-16 rounded py-2 bg-white dark:bg-gray-600'}> {post && <> -
+
}