wxml页面

<button class="share-btn" open-type="share" id="1"></button>
<button class="share-btn" open-type="share" id="2"></button>


js页面代码

onShareAppMessage: function (res) {
var that = this;
if (res.from == "button") {
if (res.target.id == 1) {
   return {
   title: '1要分享的标题',
    path: '/pages/index/index',
    success: function (res) {

  }
  }

}
   if (res.target.id == 2) {
return {
   title: '2要分享的标题',
    path: '/pages/index/index',
    success: function (res) {

  }
  }
}

}

//默认
else {
return {
   title: '右上角要分享的标题',
    path: '/pages/index/index',
    success: function (res) {

  }
  }

}
}

小程序同一页面不同按钮转发不同样式

 

相关文章:

  • 2021-08-06
  • 2021-09-24
  • 2021-12-03
  • 2021-10-11
  • 2021-08-13
  • 2021-09-25
  • 2021-07-28
  • 2021-11-30
猜你喜欢
  • 2021-09-10
  • 2021-12-23
  • 2021-10-20
  • 2022-01-10
  • 2021-12-05
  • 2021-06-08
  • 2021-09-29
相关资源
相似解决方案