微信转发 onShareAppMessage 的问题
发布于 6 年前 作者 chaoxiao 11418 次浏览 来自 问答
  • 当前 Bug 的表现(可附上截图)

在“真机测试”和“体验版”都可以看到回调函数

线上版却不可以

  • 预期表现

转发给好友成功后弹出弹窗

  • 复现路径
  • 提供一个最简复现 Demo
onShareAppMessage: function (res) {
    var that = this;
    if (res.from === 'button') {
      // 来自页面内转发按钮
      console.log(res)
    }
    return {
      title: '快来加入UN健康大家庭~',
      path: 'pages/sign/sign',
      imageUrl: '/img/forward.png',
      success: function (res) {
        // 转发成功
        // 如果这里有 shareTickets,则说明是分享到群的
        console.log(res)
        wx.showToast({
          title: '已解锁!',
          icon: 'success',
          duration: 1000
        })
      },
      fail: function (res) {
        wx.showToast({
          title: '解锁失败!',
          image: '/img/info.png',
          duration: 1000
        })
      }
       
    }
     
  }
回到顶部