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
// };
},
根据返回的数据,如果不想放分享,提前调用https://developers.weixin.qq.com/miniprogram/dev/api/share/wx.hideShareMenu.html