当后台接口有token校验的时候,通过window.location.href=url,不能携带token参数,因而此方法不能正常下载excel文件 但是通过axios请求可以实现请求头中携带token参数,具体代码如下: