县门户网站建设方案/滁州网站seo
微信小程序分享
使用方法:
onLoad(){wx.showShareMenu({withShareTicket:true,//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击menus:["shareAppMessage","shareTimeline"]})
},
//发送给朋友
onShareAppMessage(res) {// 此处的distSource为分享者的部分信息,需要传递给其他人let distSource = uni.getStorageSync('distSource');if (distSource) {return {title: '欢迎使用xxx商城',type: 0,path: '/pages/index/index?id=' + distSource,summary: "",imageUrl: "https://58d.oss-cn-hangzhou.aliyuncs.com/goods/ttg_1596073788000.png"}}
},
//分享到朋友圈
onShareTimeline(res) {let distSource = uni.getStorageSync('distSource');if (distSource) {return {title: '欢迎使用xxx商城',type: 0,query: 'id=' + distSource,summary: "",imageUrl: "https://58d.oss-cn-hangzhou.aliyuncs.com/goods/ttg_1596073788000.png"}}
},
注意事项
- 分享给朋友圈功能是2020年7月份新增的功能,目前仅支持安卓,IOS不支持
- 目前是内测阶段,部分功能还是有问题的,例如分享到朋友圈功能,其中的query参数,这个参数在onLoad中是获取不到的,也就是说从此页面分享出去的,其他人进入此页面是拿不到分享者的信息的。这样就不能做分享者与用户之间的关联了。