1、分享到好友,可以使用button,绑定open-type="share" 就可以调onShareAppMessage方法
注意:onShareAppMessage和methods、onLoad等同级
onShareAppMessage(res) {
if (res.from === 'button') { // 来自页面内分享按钮
console.log(res.target)
}
return {
title: '邀请识别', //分享的名称
path: 'pages/informationId/index?id=' + this.id + '&userId=' + this.inviteId,
mpId: 'wxc500f84b30be87a6' //此处配置微信小程序的AppId
}
},
这个项目要求就是传当前页面过去,用户好友再页面也可以进行操作,不需要登陆账号,所以传了用户id过去,可以调取相同后台数据文章来源:https://www.toymoban.com/news/detail-639539.html
2、分享到朋友圈文章来源地址https://www.toymoban.com/news/detail-639539.html
onLoad(options) {
uni.showShareMenu({
withShareTicket: true,
//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
menus: ["shareAppMessage", "shareTimeline"]
})
},
到了这里,关于onShareAppMessage 使用uniapp小程序分享好友,朋友圈功能的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!