yourself

微信小程序点击右上角按钮分享页面

/**
   * 用户点击右上角分享
   */
  onShareAppMessage: function(res) {
    if (res.from === \'button\') {
      // 来自页面内转发按钮
    }
    return {
      title: "这个小程序真棒",
      path: "pages/start/start"
    }
  },

微信公众平台教程点击跳转

222

页面按钮转发,给按钮添加open-type的share属性,就会触发转发

<button open-type="share">分享名片</button>

!!!!

接下来如果你转发名片的时候还想携带参数的话,就在跳转的页面后面加上参数的值

/**
   * 用户点击右上角分享
   */
  onShareAppMessage: function(res) {
    if (res.from === \'button\') {
      // 来自页面内转发按钮
    }
    return {
      title: "这个小程序真好",
      path: \'pages/start/start?commentUserId=\' + app.globalData.commentUserId
    }
  },

要想取到这个值就需要在跳转那个页面onload里面拿

onLoad: function(options) {
   //获取分享转发页面时携带的参数
    commentUserId =options.commentUserId;
}

 

分类:

技术点:

相关文章:

  • 2021-11-21
  • 2021-12-06
  • 2021-09-23
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2022-02-07
  • 2022-01-18
  • 2021-11-03
  • 2021-06-30
相关资源
相似解决方案