getQueryString(name) { const reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i'); const result = window.location.search.substring(1).match(reg); if (result != null) { return decodeURIComponent(result[2]); } return null; } // 通过原生 JS 去获取 code getQueryString('code')
企业微信vue hash模式下网页授权返回的code没有接到url后面在企业微信网页授权中, 这个我构造的授权链接:https://open.weixin.qq.com/connect/oauth2/authorize?appid=ww64d37a259f64a341&redirect_uri=http%3a%2f%2fkf.eipub.vip%3a3456%2f%23%2fquestion&response_type=code&scope=snsapi_base&state=#wechat_redirect 我期望得到的链接是:http://kf.eipub.vip:3456/#/question?code=otRG0-v6GX6L87pCkJOZW_XwAH2e9xcuclVlL5-eobk&state= 返回的回调链接是:http://kf.eipub.vip:3456/?code=otRG0-v6GX6L87pCkJOZW_XwAH2e9xcuclVlL5-eobk&state=#/question 返回的code按理应该拼到url后面的,请问为什么会拼到中间去了 请问这个场景有好的解决方案吗?????
2020-07-21