axios方法

作者: lesdom | 来源:发表于2019-07-02 12:44 被阅读0次

axios.all()

批量发送请求,等所有请求都有返回时,再执行统一的回调。

getOne () {
  return axios.get('/one');
},
getTwo () {
  return axios.get('/two');
},
axios.all([this.getOne(), this.getTwo()])
  .then(axios.spread((one, two) => {
    console.log('one', one)
    console.log('two', two)
  }));

网站导航

网站导航

相关文章

网友评论

    本文标题:axios方法

    本文链接:https://www.haomeiwen.com/subject/kzdzcctx.html