has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested

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

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested

has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested

如果解决了你们的问题,麻烦哥哥姐姐们给个赞哦。