控制台报错截图
提示Access to XMLHttpRequest at ‘http://localhost:xxxx/api’ from origin ‘http://xxx.xxx.com:xxxx’ has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space local
.
当你在 Vue 应用中遇到 CORS (跨源资源共享) 报错,特别是像 "The request client is not a secure context and the resource is in more-private address space " 这样的错误,通常意味着你的请求不满足安全策略的要求。
解决方案:
打开浏览器,进入chrome://flags/页面
搜索Block insecure private network requests
设置为Disabled,右下角Relaunch就好了。