小白兔晒黑了

导航

 

使用axios.all可以放入多个请求的数组。

//axios 发送并发请求
const a1 = axios({
  url:'http://123.207.32.32:8000/home/multidata'
})
const a2 = axios({
  url:'/apis/ithil_j/activity/movie_annual2017'
})
axios.all([a1,a2]).then(res=>{
  console.log(res);
})

axios.all([a1,a2]).then(axios.spread((res1,res2)=>{
  console.log(res1);
  console.log(res2);
}))

axios.all([a1,a2])返回的是一个数组。使用(axios.spread可以将数组展开
posted on 2020-07-07 21:45  小白兔晒黑了  阅读(208)  评论(0编辑  收藏  举报