onShareAppMessage: function () {
var cs=this.data.cs;
var that=this;
wx.getClipboardData({
success: function(res) {
var cs=res.data;
that.setData({
cs:cs
})
},
fail: function(res) {},
complete: function(res) {},
})
return{
success: function (res) {
var shareTicket = res.shareTickets;
if (shareTicket != null) {
wx.navigateTo({
url: ‘/pages/zhuanfashequn/sq?ipsb=’ + that.data.cs,
success: function (res) { },
fail: function (res) { },
complete: function (res) { },
})
}
else if(shareTicket==null) {
wx.navigateTo({
url: ‘/pages/zhuanfahaoyou/hy?ipsb=’ + that.data.cs,
success: function (res) { },
fail: function (res) { },
complete: function (res) { },
})
}
},
fail: function () {
wx.showModal({
title: ‘XXX’,
content: ‘XXXXXXXX’,
showCancel: false,
cancelText: ‘’,
cancelColor: ‘’,
confirmText: ‘OK’,
confirmColor: ‘’,
success: function (res) { },
fail: function (res) { },
complete: function (res) { },
})
}
}
}
代码如上,在编辑器测试正常,但真机测试中会出现以下情况:
取消转发或者成功转发后,不自动执行fail或success对应的事件,需要页面隐藏或出现后才会执行一次(如切换到其他页面会执行或直接关闭小程序重新打开会执行)
这个现象在我的手机微信更新最新版本后出现,不知是否与新版微信有关。