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)
}));