community增加事件详情

This commit is contained in:
2026-01-06 18:47:23 +08:00
parent 05ac2c8d5b
commit c3fad3da13

View File

@@ -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 = () => {