wx.config({ debug: true, appId: 'wxe34e705e29b69684', timestamp: 1757960003, nonceStr: 'uQhBRtyrMXbynVQl', signature: '703630b5f108d1e5952bba551a72691ddd8faaf3', jsApiList: ['updateAppMessageShareData','updateTimelineShareData']// 所有要调用的 API 都要加到这个列表中 }); wx.ready(function () { // 在这里调用 API //发送给朋友 wx.updateTimelineShareData({ title: title, // 分享标题 link: window.location.href, // 分享链接 imgUrl: pic, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 alert('ok'); }, cancel: function () { // 用户取消分享后执行的回调函数 alert('no'); } }); //分享到朋友圈 wx.onMenuShareTimeline({ title: title, // 分享标题 link: window.location.href, // 分享链接 imgUrl: pic, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 alert('ok'); }, cancel: function () { // 用户取消分享后执行的回调函数 alert('no'); } }); });