vue hash模式下,微信js sdk的config始终失败,全网没有可靠有效的解决方案?

小程序 文章 2020-07-31 19:01 0 14 全屏看文
vue hash模式下,微信js sdk的config始终失败,全网没有可靠有效的解决方案?







信息7:vue引入js sdk的方式尝试过weixin-jsapi和weixin-js-sdk,都能调用到wx.config,但都是设置失败




1、vue hash模式下,真的无法使用微信的js sdk吗?在线等,急,信息已经发到非常详实,请不要再对这个问题草草了之,没有下文。

2、vue hash模式下,原本跟在#后面的参数,无法配置到分享的页面链接中,有什么方案可以解决这个问题吗?


Information 1: WeChat developer tool version number: Information 2: the appid submitted by the page has been consistent with the background interface, official account background check and error free 3: the official account has been configured in the business domain name, JS interface security domain name, and web domain authorization domain name. Message 4: page link is (the URL is the hash pattern structure of Vue, and some parts have been replaced by XXX in the middle). The URL submitted to the interface for generating signature and other related parameters in the background has passed location.href.split ("ා) [0] processing. For the sake of convenient display of screenshots, encodeurcomponent is not used for the moment. During the actual test, whether encoderur is used or not is not used Icomponents failed. The interface returns the following information 5: compared with wechat JS interface signature verification tool, the generated signature is consistent. Message 6: according to the signature, random string, time stamp and appid of the official account returned by the interface. wx.config 7: Vue has tried to introduce the way of JS SDK, Weixin JS API and Weixin JS SDK can be called wx.config , but the settings failed Message 8: read through Appendix 5 of the document, and check all of them, and no non-compliance is found. Message 9: in the life cycle of Vue, both created and mounted have been tried wx.config , can't succeed. To sum up, question: 1. Under Vue hash mode, can we really not use wechat's JS SDK? Online wait, urgent, information has been sent to very detailed, please don't rush to this problem, no more below. 2. In Vue hash mode, the parameters that originally follow ා, cannot be configured in the shared page link. Is there any solution to solve this problem? Question 1 is the most urgent one. Please focus on this.


  1. vue hash模式是可以使用jssdk的,之前有一个项目就是这样使用的,问题不在于vue与其路由模式,建议还是检查签名的问题,如果你确定检查其他流程都没问题,可以检查下调用wx.config的参数是不是传入错误

2.分享链接是可以配置的,配置完sdk后, wx.updateAppMessageShareData 可以配置分享链接,将带#号的完整链接配置进去就行了

stop eating:



老兄 你试试先初始化wxjsdk 再挂载到全局的vue上