From 1610ab659dd57c95688ad193d74cbd99a6110382 Mon Sep 17 00:00:00 2001 From: "tangly1024.com" Date: Thu, 5 Sep 2024 12:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/OpenWrite.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/components/OpenWrite.js b/components/OpenWrite.js index 00d001a966f..c5fd4a7adb5 100644 --- a/components/OpenWrite.js +++ b/components/OpenWrite.js @@ -1,6 +1,5 @@ import { siteConfig } from '@/lib/config' import { isBrowser, loadExternalResource } from '@/lib/utils' -import { useRouter } from 'next/router' import { useEffect } from 'react' /** * OpenWrite公众号导流插件 @@ -9,7 +8,6 @@ import { useEffect } from 'react' * @returns */ const OpenWrite = () => { - const router = useRouter() const qrcode = siteConfig('OPEN_WRITE_QRCODE', '请配置公众号二维码') const blogId = siteConfig('OPEN_WRITE_BLOG_ID') const name = siteConfig('OPEN_WRITE_NAME', '请配置公众号名') @@ -47,7 +45,13 @@ const OpenWrite = () => { useEffect(() => { if (isBrowser && blogId) { - loadOpenWrite() + // Check if the element with id 'read-more-wrap' already exists + const readMoreWrap = document.getElementById('read-more-wrap') + + // Only load the script if the element doesn't exist + if (!readMoreWrap) { + loadOpenWrite() + } } })