首页 > 其他分享 >axios请求

axios请求

时间:2022-11-27 19:57:29浏览次数:41  
标签:axios http 请求 res 32.32 home 8000

安装

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)
})

 

 

 

 

标签:axios,http,请求,res,32.32,home,8000
From: https://www.cnblogs.com/ixtao/p/16930451.html

相关文章