由于微信官方对分享接口的调整,导致之前写的分享出现了bug。现在我们就来说下分享接口调整之后群分享功能的实现吧!
接口调整:https://developers.weixin.qq.com/community/develop/doc/0000447a5b431807af57249a551408
接口调整过后实现代码如下:
detail.js
onShareAppMessage: function(res) {
var that = this;
var url = that.data.id + '&type=' + that.data.type + '&article_type=' + that.data.article_type + '&title=' + that.data.arr.title + '&types=' + types + '&user_id=' + app.globalData.uid;
return {
title: that.data.arr.title,
path: '/pages/index/index?source=detail&id=' + url, // 当打开分享链接的时候跳转到小程序首页,并设置参数
}
}
index.js