wx.config({ debug: true, appId: 'wxe34e705e29b69684', timestamp: 1751001040, nonceStr: 'IinLo11B0IORxama', signature: '530a8a9f4251ad05f750cef4ea93df03272f4d6d', 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'); } }); });