小程序分享好友群聊实现方式如下:

<button open-type='share' class='shareFri' bindtap='onShareAppMessage'>发给群聊或好友</button>

这里必须是button按钮,只有button按钮才有share属性啦

js代码如下:
onShareAppMessage: function () {
 const self = this;
 return {
 title: 'xxx',
 path: "地址",
 success: function(res) {
 wx.showToast({
 title: '转发成功',
 duration: 1000
 })
 },
 fail: function(res) {
 wx.showToast({
 title: '转发失败',
 duration: 1000
 })
 }
 }
 }

经过这样的书写,分享好友和群聊就实现啦!

相关文章:

  • 2022-01-30
  • 2021-08-22
  • 2022-02-14
  • 2021-04-17
  • 2021-07-08
  • 2022-01-04
  • 2022-02-09
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-05-02
  • 2022-12-23
  • 2021-10-04
  • 2021-11-03
相关资源
相似解决方案