赞
踩
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过去,可以调取相同后台数据
2、分享到朋友圈
- onLoad(options) {
- uni.showShareMenu({
- withShareTicket: true,
- //设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
- menus: ["shareAppMessage", "shareTimeline"]
- })
- },
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。