我使用fetch()从api服务器获取数据.我的错误看起来像这样:
Uncaught (in promise) SyntaxError: Unexpected end of input at
fetch.then.blob.
Run Code Online (Sandbox Code Playgroud)
你能告诉我我做错了什么吗?
const weatherAPi ='https://www.metaweather.com/api/location/523920';
fetch(weatherAPi, {
mode: 'no-cors'
}).then(blob => blob.json())
.then(data => console.log(data))
Run Code Online (Sandbox Code Playgroud)