发送多个异步请求,
请求1:
request1(){
return axios('url1', {})
}
请求2:
request2(){
return axios('url2', {})
}
Promise.all([])
,参数是由多个请求组成的一个数组,返回的res
是多个请求返回结果组成的数组。
Promise.all([request1(), request2()])
.then(res =>{
console.log(res[0])
console.log(res[1])
})
发表回复