axios请求访问本地的同级的json文件,产生错误信息:Access to XMLHttpRequest a xxx from origin 'null' has been blocked by CORS

具体错误信息如下:Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

Access to XMLHttpRequest at 'D:/xxx/xxx/data.json' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https.

核实问题:Chrome 浏览器兼容性问题,适应性 特殊问题导致的。换一个火狐浏览器或其他浏览器尝试则没有问题。

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐