Super-scarlett

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

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)
}

 

发表于 2019-03-20 13:46  Super_Mi  阅读(552)  评论(0编辑  收藏  举报
 

分类:

技术点:

相关文章: