Uncaught runtime errors:

ERROR

Network Error AxiosError@webpack-internal:///./node_modules/axios/lib/core/AxiosError.js:23:18 handleError@webpack-internal:///./node_modules/axios/lib/adapters/xhr.js:160:14

cors跨域问题-LMLPHP

解决方式:

后端解决办法

/**
 * 全局跨域处理
 */
@Configuration
public class CoresConfig {
    @Bean
    public WebMvcConfigurer corsConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addCorsMappings(@NotNull CorsRegistry registry) {
                registry.addMapping("/**")
                        .allowedOriginPatterns("*")
                        .allowCredentials(true)
                        .allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
                        .maxAge(3600);
            }
        };
    }
04-27 13:20