onShareAppMessage() {
console.log("aaaaa")
return publicMethods.shareAppMessage()
},
onShareTimeline() {
console.log("sdfasdfasdf")
return publicMethods.shareAppMessage()
},
handleLongPress() {
wx.canvasToTempFilePath({
canvasId: 'myCanvas',
success: (res) => {
console.log('canvasToTempFilePath success:', res.tempFilePath);
this.setData({
canvasImg: res.tempFilePath,
});
wx.showActionSheet({
itemList: ['保存图片', '发送给好友', '分享到朋友圈'],
success: (res) => {
console.log("res", res)
switch (res.tapIndex) {
case 0:
this.saveImageToPhotosAlbum();
break;
case 1:
this.onShareAppMessage()
break;
case 2:
this.onShareTimeline()
break;
default:
break;
}
},
});
},
fail: (res) => {
console.log('canvasToTempFilePath fail:', res);
},
});
},
在一个canvas上长按执行上面的三个事件,console.log("aaaaa") 这个打印有执行,但是转发好友和朋友圈都没有弹出分享框,
path后接动态参数 onShareAppMessage() { return { title: '自定义转发标题', path: '/page/user?id=123', promise } }