小程序分享带参数有两种方式:
<button open-type="share" data-cardNo='{{cardNo}}' hover-class='none'>
<view class='shareType'>分享给好友和微信群</view>
</button>
onShareAppMessage: function (res) {
if (res.from === 'button') { // 按钮上的分享
return {
title: '',
path: '/pages/represent/represent?cardNo=' + res.target.dataset.cardno
}
}
return { //右上角分享
title: '',
path: '/pages/represent/represent?cardNo=' + wx.getStorageSync('cardNo')
}
},