try {
fetch(url)
.then((response) => response.json())
.then((responseJson) => {
})
.catch((error) => {
console.error("REQ ERROR::: " + error);
});
} catch (ex) {
console.error("REQ ERROR::: " + JSON.stringify(ex));
}
但日志说
未定义不是(评价“self.fetch”)的对象
如何解决这个问题?
这可能是与npm
&builder
缓存的问题。您必须具有取决于whatwg-fetch
另一个依赖。
您可以轻松地与npm ls whatwg-fetch
检查。
消除被利用whatwg-fetch
重新安装它的依赖。还清楚的建设者缓存。如果您使用世博expo start -c
你会找到一些解决办法,说明做:global.self = global
。这是不是一个真正的解决方案。