小程序Android分享朋友圈

利用onShareAppMessage(Object object)和onShareTimeline()就可以实现分享到朋友圈了

下面是示例代码

 onShareTimeline: function () {
    var that = this
    return {
      title: that.data.info.title,  //设置分享的标题
      query: {
         key:'id='+ this.data.info.id + '&type=' + this.data.options.type
      },  //分享路径所需的传参,例如 /pages/index/index?id=1&type=2,query里面只需传 ‘?’后面的参数
      imageUrl: that.data.info.img
    }
  },



  onShareAppMessage() {
    wx.showShareMenu({
      withShareTicket: true,
      menus: ['shareAppMessage', 'shareTimeline']
    })
    return{
      title:'xxxx小程序',
      path:'/pages/index/index'  
    }
  },

你可能感兴趣的:(微信小程序,笔记,1024程序员节,javascript,前端)