vue axios并发请求

axios.all([{
    method: 'get',
    url: 'http://123.207.32.32:8000/home/data',
    params: {
      type: 'sell',
      page: 1
    }
  },
  {
    method: 'get',
    url: 'http://123.207.32.32:8000/home/multidata'
  }
]).then(res => {
  console.log(res)
})
axios.all([{
    method: 'get',
    url: 'http://123.207.32.32:8000/home/data',
    params: {
      type: 'sell',
      page: 1
    }
  },
  {
    method: 'get',
    url: 'http://123.207.32.32:8000/home/multidata'
  }
]).then(axios.spread((res1, res2) => {
  console.log(res1);
  console.log(res2);
}))
posted @ 2021-07-15 17:34  thomas_blog  阅读(149)  评论(0编辑  收藏  举报