uniapp发送网络请求 Failed to load response data: No data found for resource with given identifier
uniapp发送网络请求 Failed to load response data: No data found for resource with given identifier
·
uniapp发送网络请求 Failed to load response data: No data found for resource with given identifier
这是跨域问题,后台请求解决跨域,添加如下
下面展示一些 内联代码片
。
@Configuration
public class CorsConfig {
@Bean
public WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
// 允许来自本地的8080端口发起的跨域请求
registry.addMapping("/**")
.allowedOrigins("*")
.allowedMethods("GET", "POST", "PUT", "DELETE")
.allowCredentials(true).maxAge(3600);
}
};
}
}
更多推荐
已为社区贡献2条内容
所有评论(0)