我已经尝试了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);
}
}
发布于 2020-06-30 00:24:20
您好,我认为您可以尝试使用像ngrok这样的服务将您的本地主机暴露到互联网上,该服务将为您生成一个url,然后尝试使用url从您的代码发送请求。只需下载并按照此处的说明进行操作:https://ngrok.com/docs
https://stackoverflow.com/questions/62638544
复制相似问题