分享成功以后调用API不工作,但是开发版本可以工作
发布于 5 年前 作者 xiulan56 17694 次浏览 来自 问答
onShareAppMessage: function () {
    const id = this.data.id;
    return {
      ...this.data.shareData,
      success: res => {
        // 转发成功
        wx.showLoading({
          title: "复活中...",
          mask: true
        });
        service({
          ...Share,
          data: {
            id: id
          }
        })
        .then(resp => {
          wx.hideLoading();
          wx.redirectTo({
            url: "../index?id=" + id
          });
        })
        .catch(error => {
          wx.hideLoading();
          wx.showToast({
            title: "复活失败",
            icon: "none"
          });
        });
      },
      fail: res => {
        // 转发失败
        wx.showToast({
          title: "复活失败",
          icon: "none"
        });
      }
    };
  }

如题,代码如上,为什么我开发环境可以工作,但是发布以后就不能工作了

回到顶部