Authored by yyq

fix share

... ... @@ -14,6 +14,14 @@ let jsApiList = [
'onMenuShareQZone'
];
const setWxShareData = function() {
window.wx.onMenuShareTimeline(shareData);
window.wx.onMenuShareAppMessage(shareData);
window.wx.onMenuShareQQ(shareData);
window.wx.onMenuShareQZone(shareData);
window.wx.onMenuShareWeibo(shareData);
};
function loadScript(url, success) {
const head = document.getElementsByTagName('head')[0];
let script = document.createElement('script');
... ... @@ -80,6 +88,10 @@ function init(qs) {
signature: res.signature,
jsApiList: jsApiList
});
window.wx.ready(function() {
setWxShareData();
});
}
})
});
... ... @@ -103,12 +115,18 @@ export default {
setShareInfo(data) {
Object.assign(shareData, data);
shareData.link = shareData.link || location.href;
if (window.wx) {
setWxShareData();
}
setTimeout(function() {
window.setShareInfo({
title: shareData.title,
summary: shareData.desc,
pic: shareData.imgUrl,
url: shareData.link || location.href
url: shareData.link
});
}, window.setShareInfo ? 0 : 300);
}
... ...