* 设置微信自定义分享内容
*/
var config = {
title: document.title,
only_title: '',
desc: '',
imgUrl: 'share_wechat.jpg'
};
define(function () {
return function weixin(config) {
if(/micromessenger/i.test(navigator.userAgent)) {
if(typeof requirejs == 'function') {
requirejs(['//xxx/wechat/sdk/share.js'], function (weixinShare) {
if(weixinShare && typeof weixinShare == 'function') {
weixinShare({
shareData: config
});
}
});
} else {
var script = document.createElement('script');
script.src = '//xxx/wechat/sdk/share.js';
script.onload = function goShare() {
if(window.weixinShare && typeof window.weixinShare == 'function') {
window.weixinShare({
shareData: config
});
}
};
document.body.appendChild(script);
}
}
};
});