uniapp官方:https://uniapp.dcloud.io/component/button
1、使用btn触发
<button class="btn" open-type="share">立即邀请好友</button>
2、method
onShareAppMessage(res) {
let item = {
id: this.id,
pid: this.infoList.user.id
}
console.log('id+++pid', item)
return {
title: '邀请好友助力',
// path: '/pages/group_detail/group_detail?id=' + this.id + '?pid=' + this.infoList.user.id,
path: '/pages/group_detail/group_detail?item=' + encodeURIComponent(JSON.stringify(item)),
success: (res) => {
// 转发成功
console.log("转发成功:" + JSON.stringify(res));
},
fail: function(res) {
// 转发失败
console.log("转发失败:" + JSON.stringify(res));
}
}
},