微信小程序---转发分享功能

1. 转发---onShareAppMessage

 2.不带参数

//用户点击右上角分享
onShareAppMessage: function (res) {
    return {
      title: 'xxx',
      path: 'pages/index/index',
      imageUrl: "../../img/share.png"
    }
  }

3.带参数

onShareAppMessage: function (res) {
    var _this = this;
    let id = _this.data.id;
    return {
      title: 'xxx',
      path: 'pages/index/index?id=' + id,
      imageUrl: "../../img/share.png"
    }
  }

4.转发的参数要在onLoad的options运用

onLoad: function (options) {
    console.log('id:', options.id)
}
原文地址:https://www.cnblogs.com/Super-scarlett/p/10564456.html