axios 请求多个接口
时间:2019-12-10 17:33:56
收藏:0
阅读:419
axios.all([
axios.get(‘https://api.github.com/xxx/1‘),
axios.get(‘https://api.github.com/xxx/2‘)
])
.then(axios.spread(function (userResp, reposResp) {
// 上面两个请求都完成后,才执行这个回调方法
console.log(‘User‘, userResp.data);
console.log(‘Repositories‘, reposResp.data);
}));
原文:https://www.cnblogs.com/yangsg/p/12017801.html
评论(0)