var shareData = { title: '飞船登陆汪星球！超多萌宠可爱来袭！',//标题 desc: '谁家汪更可爱？',//描述 link: "https://activity.m.duiba.com.cn/customShare/share?id=3346",//链接 imgUrl: 'https://yun.duiba.com.cn/db_games/activity/yjyc/share.jpg',//图片 } function invokeWX(shareData) { console.log("打印分享") console.log(shareData) wx.onMenuShareTimeline({ title: shareData.title, //标题 desc: shareData.desc, //描述 link: shareData.link, //链接 imgUrl: shareData.imgUrl, //图片 success: function () {}, cancel: function () {} }); wx.onMenuShareAppMessage({ title: shareData.title, //标题 desc: shareData.desc, //描述 link: shareData.link, //链接 imgUrl: shareData.imgUrl, //图片 success: function (e) {}, cancel: function () {} }); } wx.ready(function() { invokeWX(); });