在用H5做微信静默登陆的时候会在路由上返回不需要的参数,so这时候需要把它干掉需要用到一个方法 History.replaceState()
语法:
history.replaceState(stateObj, title [,url]);
例子:这里我用了正则获取到code前的字符串
history.replaceState(null, null, window.location.href.match(/(S*)&code/)[1])