From 1862012d6949ec35bc7cd5738a2435d30418ac82 Mon Sep 17 00:00:00 2001 From: tangly1024 Date: Sun, 12 Mar 2023 12:13:44 +0800 Subject: [PATCH] fix/theme-next-share-wechat --- themes/next/components/ShareBar.js | 8 ++++---- themes/next/config_next.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/next/components/ShareBar.js b/themes/next/components/ShareBar.js index 2f174b13..c595da13 100644 --- a/themes/next/components/ShareBar.js +++ b/themes/next/components/ShareBar.js @@ -8,17 +8,17 @@ import { useGlobal } from '@/lib/global' import CONFIG_NEXT from '../config_next' const ShareBar = ({ post }) => { + const router = useRouter() + const [qrCodeShow, setQrCodeShow] = React.useState(false) + const { locale } = useGlobal() if (!CONFIG_NEXT.ARTICLE_SHARE) { return <> } - const router = useRouter() const shareUrl = BLOG.LINK + router.asPath // 二维码悬浮 - const [qrCodeShow, setQrCodeShow] = React.useState(false) const btnRef = React.createRef() const popoverRef = React.createRef() - const { locale } = useGlobal() const openPopover = () => { createPopper(btnRef.current, popoverRef.current, { @@ -57,7 +57,7 @@ const ShareBar = ({ post }) => {
-
+
diff --git a/themes/next/config_next.js b/themes/next/config_next.js index db098307..5504b8df 100644 --- a/themes/next/config_next.js +++ b/themes/next/config_next.js @@ -30,7 +30,7 @@ const CONFIG_NEXT = { WIDGET_DARK_MODE: false, // 显示日间/夜间模式切换 WIDGET_TOC: true, // 移动端显示悬浮目录 - ARTICLE_SHARE: false, // 文章分享功能 + ARTICLE_SHARE: process.env.NEXT_PUBLIC_ARTICLE_SHARE || false, // 文章分享功能 ARTICLE_RELATE_POSTS: true, // 相关文章推荐 ARTICLE_COPYRIGHT: true // 文章版权声明