has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
搭建项目 springboot + vue.js 报了这个错
解决办法
在controller层加一个注解
@CrossOrigin


如果解决了你们的问题,麻烦哥哥姐姐们给个赞哦。
本文介绍了一种常见的跨域资源共享(CORS)错误:请求资源缺少'Access-Control-Allow-Origin'头。通过在Spring Boot项目的Controller层添加@CrossOrigin注解,可以轻松解决此问题。
1万+

被折叠的 条评论
为什么被折叠?



