微信JS-SDK說明文檔
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141115
```
// 調用微信方法
function wxReady(appId, nonceStr, signature, timestamp, shareUrl) {
wx.config({
debug: false, // 開啟調試模式,調用的所有api的返回值會在客戶端alert出來,若要查看傳入的參數,可以在pc端打開,參數信息會通過log打出,僅在pc端時才會打印。
appId: appId, // 公眾號的唯一標識
timestamp: timestamp, // 生成簽名的時間戳
nonceStr: nonceStr, // 生成簽名的隨機串
signature: signature,// 簽名
jsApiList: [
'updateAppMessageShareData', //分享給朋友
'updateTimelineShareData' // 分享給朋友圈
] // 需要使用的JS接口列表
});
wx.ready(function(){
wx.updateAppMessageShareData({
title: '【INVITATION】2019 GAAS', // 分享標題
desc: '2019全球資產配置峰會邀請函', // 分享描述
link: shareUrl, // 分享鏈接,該鏈接域名或路徑必須與當前頁面對應的公眾號JS安全域名一致
imgUrl: 'http://cdn.pub.edaili.com/GAAS/gaas.png', // 分享圖標
success: function () {
// 設置成功回調
}
})
wx.updateTimelineShareData({
title: '【INVITATION】2019 GAAS', // 分享標題
link: shareUrl, // 分享鏈接,該鏈接域名或路徑必須與當前頁面對應的公眾號JS安全域名一致
imgUrl: 'http://cdn.pub.edaili.com/GAAS/gaas.png', // 分享圖標
success: function () {
// 設置成功回調
}
})
});
}
```