【发布时间】:2020-10-19 15:23:02
【问题描述】:
我已经尝试了 Stack Overflow 的一些解决方案,但仍然无法解决这个问题。需要其他解决方案。
componentDidMount(){
this.getCar()
}
async getCar() {
try {
const response = await axios.get('http://127.0.0.1:8000/topratedcars');
console.log(response);
} catch (error) {
console.error(error);
}
}
【问题讨论】:
-
什么是问题?给minimal reproducible example。
-
我在前端使用 axios 来获取 api 数据,这在邮递员中运行良好,但是当我从代码中生成 req 时,它显示网络错误
-
它没有进入“尝试”块
标签: node.js react-native get axios general-network-error