wx.ready(function(){ //分享到 qq 和朋友 wx.updateAppMessageShareData({ title: share_info.title, // 分享标题 desc: share_info.desc, // 分享描述 link: share_info.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 imgUrl: share_info.imgUrl, // 分享图标 success: function () { console.log('timeline'); } }); //分享到 qq空间 和朋友圈 wx.updateTimelineShareData({ title: share_info.title, // 分享标题 link: share_info.link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致 imgUrl: share_info.imgUrl, // 分享图标 success: function () { console.log('timeline'); } }); //分享到朋友圈 即将废弃 wx.onMenuShareTimeline({ title: share_info.title, // 分享标题 link: share_info.link, // 分享链接 imgUrl: share_info.imgUrl, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 console.log('timeline'); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); //分享给朋友 即将废弃 wx.onMenuShareAppMessage({ title: share_info.title, // 分享标题 desc: share_info.desc, // 分享描述 link: share_info.link, // 分享链接 imgUrl: share_info.imgUrl, // 分享图标 type: '', // 分享类型,music、video或link,不填默认为link dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空 success: function () { // 用户确认分享后执行的回调函数 console.log('appmessage'); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); //分享到qq 即将废弃 wx.onMenuShareQQ({ title: share_info.title, // 分享标题 desc: share_info.desc, // 分享描述 link: share_info.link, // 分享链接 imgUrl: share_info.imgUrl, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 console.log('qq'); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); //分享到微博 wx.onMenuShareWeibo({ title: share_info.title, // 分享标题 desc: share_info.desc, // 分享描述 link: share_info.link, // 分享链接 imgUrl: share_info.imgUrl, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 console.log('weibo'); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); //分享到qq控件 即将废弃 wx.onMenuShareQZone({ title: share_info.title, // 分享标题 desc: share_info.desc, // 分享描述 link: share_info.link, // 分享链接 imgUrl: share_info.imgUrl, // 分享图标 success: function () { // 用户确认分享后执行的回调函数 console.log('qzone'); }, cancel: function () { // 用户取消分享后执行的回调函数 } }); });