springboot+vue出现的问题,

的资源上不存在'access control Allow Origin'标头。

img

这个是跨域问题。https://blog.csdn.net/qq_42825101/article/details/108711579

也可以通过后台去解决,我看你是用的springboot,第一种方式:@CrossOrigin(origins = "*", maxAge = 3600) ;第二种写一个过滤器;

java后端配置一下跨域

跨域 你可以在springboot中创建一个工具类

@Configuration
public class CorsConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
                .maxAge(3600);
    }
}