微信jssdk自由分享
简介
微信jssdk自由分享
// 这是微信的配置参数
config = JSON.parse(rs);
wx.config({
debug: false,
appId: config.appId,
timestamp: config.timestamp,
nonceStr: config.nonceStr,
signature: config.signature,
jsApiList: config.jsApiList
});
wx.ready(function () {
wx.checkJsApi({
jsApiList: config.jsApiList,
success: function () {
window.history.replaceState({}, '', '/' + randomString(4) + '.html');
config.appId = "wx" + randomString(14) + "12";
wx.config(config);
wx.hideOptionMenu(),
wx.showMenuItems({menuList: ["menuItem:share:appMessage"]});
//setShareInfo();
}
});
var shareData = {
title: 'xxxx',
link: 'xxx',
desc: 'xxx',
imgUrl: 'xxxx',
success: function () {
// ...
}
};
wx.onMenuShareAppMessage(shareData);
});