1、改变vue模式为history,小编没有试
2、通过配置nginx实现
A、替换跳转网址中的#为其他字符串,例如我的
const url = this._getUrl( "https://open.weixin.qq.com/connect/oauth2/authorize", { appid: this.appId, redirect_uri: encodeURIComponent( location.href.replace("#", "virtually") ), response_type: "code", scope: this.scope, state: this.state, } ); location.href = `${url}#wechat_redirect`; console.log("完整的Url"); console.log(location.href);
我替换成了virtually,这样返回的时候就是正常的返回了。
2、在nginx中配置跳转
location / { rewrite ^/virtually/(.*)$ /#$1 permanent; }
重启下nginx,搞定。调试只能用微信开发者工具调试了
标签:vue,中带,微信,nginx,href,location,virtually From: https://www.cnblogs.com/wx18638101223/p/17611937.html