Bootstrap

小程序点击按钮分享

wxml

<button open-type="share">
    <view>分享给好友</view>
</button>

JS

  onShareAppMessage: function (res) {
    if (res.from === 'button') {
      console.log(res.target)
    }
    return {
      title: "分享给好友",
      path: '/pages/share/share',
      imgurl:'',
      success: function (res) {
        console.log('成功', res)
      }
    }
  },

;