微信小程序右上角转发分享到朋友圈

//用户点击右上角分享转发
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()

     

  • 图示

  •  

     

     

posted @ 2020-08-03 11:19  Chervehong  阅读(2083)  评论(0编辑  收藏  举报