zjxiang008

 

与methods同级,可以直接调取小程序右上角的分享

onShareAppMessage(res) {

  if (res.from === \'button\') {// 来自页面内分享按钮
    console.log(res.target)
  }
  return {
    title: \'分享的标题\',
    path: \'分享的路径\'
  }

}


点击button按钮实现分享,同样需要onShareAppMessage

<button open-type="share" :data-type=\'{title}\' :data-id=\'{shareid}\'></button>

注:如果需要带参数,data-后面加你声明的,例:data-id,在onShareAppMessage里面的res.target里面能找到传递的参数

 

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-12-07
  • 2021-04-22
  • 2021-07-20
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-04
  • 2021-09-06
相关资源
相似解决方案