axios请求
安装
npm install axios --save
axios基本使用
axios({
url: 'http://123.207.32.32:8000/home/multidata',
method: 'get'//不写默认get方式
}).then(res => {
console.log(res.data)
})
axios({//get请求带参数
url: 'http://123.207.32.32:8000/home/data',
params: {
type:'pop',
page: 1
}
}).then(res => {
console.log(res.data)
})
并发请求
axios.all([
axios('http://123.207.32.32:8000/home/multidata'),
axios('http://123.207.32.32:8000/home/multidata')
]).then((results) => {//返回results数组
console.log(results)
})


浙公网安备 33010602011771号