fetch请求,跨域报错,mode: "no-cors"?
http://localhost:3000访问http://localhost:8080/a/b接口,报错“Failed to load http://localhost:8080/a/b: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.”
这个报错是什么意思??
我如果在请求中加入参数“
mode: "no-cors"
”就能正常访问了,这个
mode: "no-cors"是什么意思?起到什么作用?
还有,响应的status=200,可是response.ok是false,response.ok不应该是true吗?难道我要根据status判断请求是否成功?
请大佬赐教!万分感谢!