微信小程序实例:分享给一个人还是分享到群的判断代码
微信小程序的分享功能,在最新版库的ide上已经不能拿到分享回调了,官方api也删除了对应的回调函数,看样子是砍掉了,不过真机测试还是可以的,话不多说,上代码:
/* // 分享功能回调 onLoad: function (options) { wx.showShareMenu({ //只有拥有 shareTicket 才能拿到群信息,用户每次转发都会生成对应唯一的shareTicket 。 withShareTicket: true }); }, onShareAppMessage: function () { var that = this; console.log("onShareAppMessage") return { title: ‘穿越换装‘, path: ‘/pages/avatarUpload/index/index‘, success: function (res) { if (res.errMsg == ‘shareAppMessage:ok‘) { if (res.hasOwnProperty(‘shareTickets‘)) { console.log(res.shareTickets[0]); //分享到群 that.data.qunshare = 1; that.data.geshare = 1; } else { // 分享到个人 that.data.geshare = 1; } wx.showToast({ title: ‘分享成功‘, icon: ‘success‘, duration: 500 }); console.log("shareAppMessage:ok"+ "qun"+ that.data.qunshare +"geren"+ that.data.geshare) } }, fail: function (res) { if (res.errMsg == ‘shareAppMessage:fail cancel‘) { wx.showToast({ title: ‘分享失败‘, icon: ‘loading‘, duration: 500 }) } console.log("shareAppMessage:err") } } }, */
真机调试 return中内容无法进去;
--
相关推荐
kgshuo 2020-09-25
Tomato 2020-09-10
taiyangyu 2020-09-10
CodeAndroid 2020-09-10
small 2020-07-29
sucheng 2020-07-26
zuoliangzhu 2020-07-20
CodeAndroid 2020-07-14
xiaoxubbs 2020-07-04
sucheng 2020-06-25
kgshuo 2020-06-14
意外金喜 2020-06-14
zuoliangzhu 2020-06-14
tianping 2020-06-14
hgzhang 2020-06-14
killgod 2020-06-14
戴翔的技术 2020-06-14
郴州小程序 2020-06-13