diff --git a/src/components/ShareButton/index.js b/src/components/ShareButton/index.js index 19ca7b54..1df43504 100644 --- a/src/components/ShareButton/index.js +++ b/src/components/ShareButton/index.js @@ -100,24 +100,13 @@ const ShareButton = ({ // 点击分享按钮 const handleShareClick = useCallback(() => { - if (isInWechat) { - // 在微信中,打开分享引导弹窗 - onOpen(); - } else if (navigator.share) { - // 支持 Web Share API - navigator.share({ - title: title || document.title, - text: desc, - url: link || window.location.href, - }).catch(() => { - // 用户取消或失败,打开弹窗作为降级 - onOpen(); - }); - } else { - // 不支持 Web Share API,打开弹窗 - onOpen(); - } - }, [isInWechat, title, desc, link, onOpen]); + // 统一打开分享弹窗,提供复制链接功能 + // 原因: + // 1. 微信内:需要引导用户点击右上角分享 + // 2. 微信外:navigator.share 无法分享到微信,复制链接更实用 + // 3. PC端:直接复制链接是最可靠的方式 + onOpen(); + }, [onOpen]); // 渲染按钮 const renderButton = () => {