//用戶點擊右上角分享轉發
onShareAppMessage: function () {
var that = this;
var id = this.options.id; //data,return 數據id
var title= this.options.title; //data,return 數據title
return {
title: title || '',
imageUrl: '',
path: '/pages/goods_list/goods_list?id=' + id,
}
},
//用戶點擊右上角分享朋友圈
onShareTimeline: function () {
var that = this;
var id = this.options.id; //data,return 數據id
var title=this.options.title; //data,return 數據title
return {
title: title || '',
query: 'id=' + id,
imageUrl: '',
}
},
//生命周期函數--監聽頁面加載
onload: function () {
wx.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage', 'shareTimeline']
});
}
-
onShareAppMessage(Object object)
onShareTimeline() 相關參數文檔下面鏈接
- https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareAppMessage-Object-object
- "shareAppMessage"表示“發送給朋友”按鈕,"shareTimeline"表示“分享到朋友圈”按鈕
- 顯示“分享到朋友圈”按鈕時必須同時顯示“發送給朋友”按鈕,顯示“發送給朋友”按鈕時則允許不顯示“分享到朋友圈”按鈕
-
wx.showShareMenu()
-
圖示
-