收藏
回答

使用button中的open-type配合onShareAppMessage事件做微信转发功能?

button设置为open-share后,如何根据条件动态终止分享,在onShareAppMessage中return false并未生效

 onShareAppMessage: function () {
    let initInviterView = this.data.initInviterView;
    const defaultOps = {
      title: initInviterView.stageBaseInfo?.wechatShareTitle,
      desc: initInviterView.stageBaseInfo?.wechartShareText,
      imageUrl: initInviterView.stageBaseInfo?.wechatSharePic,
      path: "pages/home/home",
    };


    let path = "pages/home/home";
    const promise = new Promise(resolve=>{
      if (wx.getStorageSync("activitycode")) {
        this.requestInvite()
          .then((invitePageCode) => {
            console.log(invitePageCode, "invitePageCode");
             path = `pages/activity/invitation/invitedPay/index?activitycode=${wx.getStorageSync(
              "activitycode"
            )}&invitePageCode=${invitePageCode}`;
              resolve({
                ...defaultOps,
                path,
              })
          })
          .catch((err) => {
          });
      }
    })
    return false
    // return {
    //   ...defaultOps,
    //   promise
    // };
  },
回答关注问题邀请回答
收藏

1 个回答

登录 后发表内容