Axios有两种并发请求的方式
第一种 通过Axios.allAxios.all( [
Axios.get('http://localhost:9999/student/student/getully')
Axios.get('http://local:9999/student/student/findstatut/finStudentById,{
Params:{id:}
}')
]).then(res =>{ //请求成功后返回的是一个数组
Console..log(res[0]);
Console.log("-------") //通过这边分开
Console.log(res[1])
}).cathch(err =>{
Console.log(err);
})
第二种 通过Axios.spread
Axios.all( [
Axios.get('http://localhost:9999/student/student/getully')
Axios.get('http://local:9999/student/student/findstatut/finStudentById,{
Params:{id:}
}')
]).then(axios.spread((res1,res2) =>{ //请求成功后返回的是一个数组
Console..log(res[0]);
Console.log("-------") //通过这边分开
Console.log(res[1])
}).cathch(err =>{
Console.log(err);
})