微信小程序-转发到群后获取到群信息
2017-12-05 本文已影响33人
王小傲
正常的分享的成功回调是不会有shareTicket 详情的
onShareAppMessage: function (res) {
if (res.from === 'button') {
// 来自页面内转发按钮
console.log(res.target)
}
return {
title: '自定义转发标题',
path: '/page/user?id=123',
success: function(res) {
// 转发成功
},
fail: function(res) {
// 转发失败
}
}
}
可以在onLoad中添加wx.showShareMenu并设置withShareTicket:true才能获取到


然后调用wx.getShareInfo,就能获取到数据,然后将数据要转到后台进行解析

后台解析后结果为

openGID是微信分发的唯一群标识,可以通过群ID判断用户是否来自同一个微信群,更多东西就大家一起继续探索吧,如果有什么意见或不足的,欢迎在下方评论区踊跃发表您的高见!