//当使用axios.post(url[,data[,config]])的时候参数是写在data中
axios.post(url[,data[,config]])
1.axios发送并发请求:如果同时有多个请求的话,就使用axios.all([])返回的结果是一个数组。
axios.all([axios({
url:'http://123.207.23.32:8000/home/multidata'
}),
axios({
url:'http://123.207.23.32:8000/home/data',
params:{
type:'sell',
page:5
}
})]).then(results => {
console.log(results[0]);
console.log(results[1]);
})
//还有一种拿到结果的方法:使用axios.apread可将数组[res1,res2]展开为res1,res2
axios.all([axios({
url:'http://123.207.23.32:8000/home/multidata'
}),
axios({
url:'http://123.207.23.32:8000/home/data',
params:{
type:'sell',
page:5
}
})]).then(axios.spread((res1,res2) => {
console.log(res1);
console.log(res2);
}))