微信小程序点击按钮分享指定页面
1.在wxml里写所要点击的按钮
<button data-info='{{order}}' open-type="share" hover-class='none'>分享</button>
2.在js页面
//gbi指用户所要传递的参数(可以没有参数)
//path:用户需要分享的页面
onShareAppMessage: function (res) {let gbid = res.target.dataset.info.order_id;return {title: '分享',path: '/pages/imgroup/imgroup?tgid=' + gbid,imageUrl: 'https://......./img/groupshare.png', //用户分享出去的自定义图片大小为5:4,success: function (res) {// 转发成功wx.showToast({title: "分享成功",icon: 'success',duration: 2000})},fail: function (res) {// 分享失败},}},