浏览了网上的一个帖子,还没试Vue项目报错:Uncaught (in promise) Error: Network Error_卿酒疏茶的博客-CSDN博客
另外看到一个帖子,后端加congfig类,亲测无效:
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CrosConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("POST", "GET", "PUT", "OPTIONS", "DELETE")
.allowCredentials(true)
.allowedHeaders("*")
.maxAge(3600);
}
帖子地址Uncaught (in promise) Error: Network Error at createError(axios跨域问题) -