vue项目,开发环境下,axios造成跨域问题:
Access to XMLHttpRequest at 'http://....:8888/login' from origin 'http://localhost:8080' has been blocked by CORS policy: Cannot parse Access-Control-Allow-Headers response header field in preflight response.
1. config/index.js
2.main.js
3.dev.env.js
4.调用
注:Google浏览器可以单独配置,解决跨域问题
在 "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 后面添加 --disable-web-security --user-data-dir= 安装路径\Chrome\
打开浏览器出现下图,说明配置成功,不再显示跨域问题: