04-并发请求

nobility 发布于 2022-02-27 229 次阅读


并发请求

  • axios.all(iterable):iterable是可迭代接口,一般使用数组即可
  • axios.spread(callback):callback是统一处理axios.all(iterable)的请求回调
axios.all([
    axios.get("/one.json"),
    axios.get("/two.json")
  ])
  .then(
    axios.spread((oneRes, towRes) => {	//上面有几个请求,则该回调有几个参数
      console.log(oneRes, towRes);
    })
  )
此作者没有提供个人介绍
最后更新于 2022-02-27