需要确保以下代码中的URL正确,并且服务器正常运行。
axios.get('/some-endpoint')
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
另外,也需要在浏览器控制台中查看网络选项卡,以检查请求是否发送成功,以及返回的状态码是否正确。如果需要,还可以使用axios的拦截器,对请求和响应进行进一步的处理。
上一篇:Axios无法返回结果。