1.先要把open-type设置成share
<button wx:if="{{shareMid == undefined}}" open-type="share" class="save-order">分享</button>
注意:右上角也可进行分享
2.触发 onShareAppMessage 方法
//分享 onShareAppMessage:function () {
return {
title: this.data.rows.keyword,
desc: this.data.rows.linename,
path: '/pages/home/home?id='+ this.data.pageId,表示用户点击分享页跳转到的位置
imgUrl:自定义图片的地址
} },