调试
前端打开debug模式,浏览器打开时在console里会打印微信分享初始化信息,在微信里会以alert形式出现。
常见问题
-
签名的时候注意大小写
-
签名时候用的url需要和当前位置的url保持一致
-
微信二次分享失败
微信在第二次分享的链接里增加了后缀,如?from=singlemessage&isappinstalled=1,这里需要转义$.ajax({ url: \'https://domain/wechatshare/sign?url=\' + encodeURIComponent(window.location.href.split(\'#\')[0]), type: \'get\', success: function (data) { data = JSON.parse(data) data.jsApiList = [ \'onMenuShareTimeline\', \'onMenuShareAppMessage\',\'onMenuShareQQ\' ]; wx.config(data); }, error: function (xhr, textStatus) { } })