甚至示例域在浏览器上产生 CORS 错误:
fetch('https://example.com').then(console.log).catch(console.error)
// Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://example.com/. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). Status code: 200.
// TypeError: NetworkError when attempting to fetch resource.
有我可以在浏览器上尝试的示例域吗?
在package.json中使用代理
例如,如果您使用的域如下
"proxy": "http://yourApiDomain"