微信小程序右上角轉發分享到朋友圈


//用戶點擊右上角分享轉發
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()

     

  • 圖示

  •  

     

     


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM