直接上代码了:
$.ajax({
url: '/wx/sdk',
type: 'get',
data:{
url: encodeURIComponent(location.href.split('#')[0])
}
}).done(function(msg) {
wx.config({
debug: true,
appId: msg.appid,
timestamp: msg.timestamp,
nonceStr: msg.nonceStr,
signature: msg.signature,
jsApiList: ['onMenuShareTimeline']
});//wx/config end
wx.ready(function() {
wx.onMenuShareTimeline({//分享朋友圈
title: '小咳嗽',
link: 'www.e-cough.com/product/100003',
imgUrl: 'www.e-cough.com/uploads/1508250089609.jpeg',
success: function(res) {
alert('分享');
},
cancel: function(res) {
alert('取消');
}
});//分享朋友圈 end
});//ready end
});//ajax end
效果如图:
debug没错啊。很醉好吗?求解答!!谢谢
https://segmentfault.com/q/10...