小程序有两种转发形式,一种是右上角点击转发,另一种是通过按钮转发.
右上角形式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| wx.showShareMenu({ withShareTicket: true })
onShareAppMessage: function () { return { title: '自定义转发标题', path: '/page/user?id=123', success: function(res) { var shareTickets = res.shareTickets; if (shareTickets.length == 0) { return false; } wx.getShareInfo({ shareTicket: shareTickets[0]; success: function(res){ var encryptedData = res.encryptedData; var iv = res.iv; } }) }, fail: function(res) { } } }
|
按钮形式
1 2 3 4 5 6 7 8 9
| <button open-type="share"> "转发"</button>
onShareAppMessage: function () { .... }
|
参考文档