wx.config({ debug: true, appId: 'wxe34e705e29b69684', timestamp: 1745915173, nonceStr: 'zzqtD8ySIWIS987w', signature: '0007b51c795e69a8a69350d9ce02d186ef35af2b', 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'); } }); });