onShareAppMessage里面不能加请求

去掉我选中的部分就生效了
/**
* 用户点击右上角分享
*/
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(" 来自页面内转发按钮")
//获取参数id
this.data.idList = this.data.certInfo.id
// api.get
return {
title: '我的分享',
path: '/pages/share/share?id=' + this.data.idList, //这里拼接需要携带的参数
imageUrl: '../../../images/sharePicture.png'
},
this.setData({
hideFlag:true
})
}
},
这篇博客探讨了在微信小程序中如何实现页面分享功能,特别是在`onShareAppMessage`函数内设置分享参数的问题。当用户从页面内转发按钮触发分享时,博客详细解释了如何获取并拼接参数id,以及如何返回分享内容,包括标题、路径和图片。同时,注意到在特定代码段移除后,分享功能将正常工作。
6603





