小程序分享

小程序中除了右上角的自带分享之外,还可以做成点击按钮分享

wxml

             view style="width:50%"                button style="background: #1CC88A; color: #fff; width:70%" class="button-row" id="shareBtn" open-type="share" type="primary"                  view分享给亲友涨工资/view                /button              /view

wxss

.button-row{  font-size: 14px;}

js

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

具体效果可扫码看效果
小程序

TAG标签: 微信小程序点击按钮

http://www.xiaochengxub.com/read-103017.html