方式一
<script>
axios([
axios.get(‘http://localhost:8080/student/getAllStudent‘),
axios.post(‘http://localhost:8080/student/getStudentById‘,{id:1})
]).then(res=>{//请求成功相应的是一个数组
console.log(res[0]);
console.log(res[1]);
});
</script>
方式二(使用spread方法处理相应数组结果)
<script>
axios([
axios.get(‘http://localhost:8080/student/getAllStudent‘),
axios.post(‘http://localhost:8080/student/getStudentById‘,{id:1})
]).then(
axios.spread((res1,res2)=>{
console.log(res1);
console.log(res2);
})
);
</script>
原文:https://www.cnblogs.com/ixtao/p/14182415.html