📜  axios 获取 url 数组 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:43.042000             🧑  作者: Mango

代码示例1
let linksArr = ['https://jsonplaceholder.typicode.com/posts', 'https://jsonplaceholder.typicode.com/comments'];

axios.all(linksArr.map(l => axios.get(l)))
  .then(axios.spread(function (...res) {
    // all requests are now complete
    console.log(res);
  }));