wx.showModal中,点击确定后,调用转发功能
发布于 5 年前 作者 juan91 3340 次浏览 来自 问答
wx.showModal({
              title: '提示',
              content: '希望分享投诉给更多人看到吗?',
              cancelText: '暂不分享',
              confirmText: '分享一下',
              success: function (res) {
                if (res.confirm) {
                  console.log(res.confirm);
                  this.onShareAppMessage();
                };
              },
              fail: function (err) {
                console.log(err);
              },
            })
onShareAppMessage: function (e) {
    return {
      title: title,
      path: '/pages/detail/detail?id=' + Id,
      imageUrl: '../../images/135.png',
    };
  },

我这样调用转发函数是没有用的,求解如何处理。

2 回复

需手写一个modal,不能直接使用this.onShareAppMessage()

官方文档说的很清楚了,这只是回调,要想实现这种功能,只能你自己实现一个风格类似的弹窗,用button做了

https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/page.html#%E9%A1%B5%E9%9D%A2%E4%BA%8B%E4%BB%B6%E5%A4%84%E7%90%86%E5%87%BD%E6%95%B0

监听用户点击页面内转发按钮(<button> 组件 open-type=“share”)或右上角菜单“转发”按钮的行为,并自定义转发内容。

回到顶部