Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question]微信onShareTimeline 分享朋友圈,title跟 imageUrl不生效 #2201

Closed
waylon-gmail opened this issue Jul 30, 2021 · 12 comments
Closed
Assignees

Comments

@waylon-gmail
Copy link

waylon-gmail commented Jul 30, 2021

分享给朋友是可以的。但是分享朋友圈不生效。不知道什么原因。

  // query: 自定义页面路径中携带的参数,如 path?a=1&b=2 的 “?” 后面部分
  const handleShareTimeline = () => {
    return {
      title: '我是自定义title',   // 不生效, 分享后是页面的title而不是自定义title
      query: `key=123`,
      imageUrl: 'https://xxxx.png',  // 不生效, 看到的是logo
    }
  };

  if (isWeChatMiniProgram) {
    registerNativeEventListeners(Index, ['onShareTimeline']);
  }

  useEffect(() => {
    if (isWeChatMiniProgram) {
      wx.showShareMenu({
        withShareTicket: true,
        menus: ['shareTimeline'],
      });
      addNativeEventListener('onShareTimeline', handleShareTimeline);
    }
    return () => {
      if (isWeChatMiniProgram) {
        removeNativeEventListener('onShareTimeline', handleShareTimeline);
      }
    };
  }, []);
@waylon-gmail waylon-gmail changed the title [Question]onShareTimeline 分享朋友圈,title跟 imageUrl不生效 [Question]微信onShareTimeline 分享朋友圈,title跟 imageUrl不生效 Jul 30, 2021
@ChrisCindy
Copy link
Collaborator

待排查复现

@waylon-gmail
Copy link
Author

请问这个有进展吗?比较需要这个功能。

@ChrisCindy
Copy link
Collaborator

抱歉,今天排查处理一下

@ChrisCindy
Copy link
Collaborator

文档中提到『分享到朋友圈』功能如需生效,需要同时配置 onShareAppMessage 和 onShareTimeline。并且该功能仅在 Android 手机上可用。目前测试配置 onShareAppMessage 后能够正常分享至朋友圈。

@waylon-gmail
Copy link
Author

waylon-gmail commented Aug 10, 2021

抱歉可能上面描述的不够清晰,分享是可以分享出去,我有同时配置两个,分享出去是可以的,

但问题是 title的值,以及imageUrl不对。

title 无法自定义
imageUrl 无法自定义

现象是无论设置什么,最后分享出去的都是 页面的标题(分享框显示的是应用的名称,分享出去后显示的是页面的title),而不是设置的title。
image

@ChrisCindy
Copy link
Collaborator

在原生项目中是否测试使用过该能力?有可能是该 API 自身不太稳定。

@ChrisCindy
Copy link
Collaborator

另,如有已上线项目,可在这里提交一下 raxjs/miniapp#132

@waylon-gmail
Copy link
Author

原生api是没有问题的。我看微信开发者中心有很多人提问,都是因为用第三方框架不行,比如 taro等

@ChrisCindy
Copy link
Collaborator

我今天再测试一下

@ChrisCindy
Copy link
Collaborator

问题已找到,预计本周四发版修复

@waylon-gmail
Copy link
Author

感谢!

@ChrisCindy
Copy link
Collaborator

已发版,重装依赖,确定 miniapp-render 为 v2.8.1 即可

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants