vue-axios基本使用

 

   axios的基本使用步骤如下:

    1. 安装axios。

npm install axios --save

    2. 导入axios

    3. 使用:axios返回的是promise,因此请求成功会调用then

axios({
  url: 'http://httpbin.org/',
  method: 'get'
}).then(res => {
  console.log(res)
})

    4. 打印结果:

 

posted @ 2021-04-11 16:02  爱编程DE文兄  阅读(81)  评论(0编辑  收藏  举报