From ff75c6ea9965868679692d992007c06396e46d77 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Wed, 5 Mar 2025 15:38:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4properties?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/NotionPage.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/NotionPage.js b/components/NotionPage.js index eace0637..1e5bd607 100644 --- a/components/NotionPage.js +++ b/components/NotionPage.js @@ -98,6 +98,22 @@ const NotionPage = ({ post, className }) => { }) }) } + + // 查找所有具有 'notion-collection-page-properties' 类的元素,删除notion自带的页面properties + const timer = setTimeout(() => { + // 查找所有具有 'notion-collection-page-properties' 类的元素 + const elements = document.querySelectorAll( + '.notion-collection-page-properties' + ) + + // 遍历这些元素并将其从 DOM 中移除 + elements?.forEach(element => { + element?.remove() + }) + }, 1000) // 1000 毫秒 = 1 秒 + + // 清理定时器,防止组件卸载时执行 + return () => clearTimeout(timer) }, [post]) return (