前端培训之axios 的使用

1. 效果
ajax_test.gif
2. 在线文档
https://github.com/pagekit/vue-resource/blob/develop/docs/http.md
3. 下载:
npminstallaxios–save
4. 编码
// 引入模块

importaxiosfrom’axios’
// 发送 ajax 请求

axios.get(url)

    .then(response=>{

         console.log(response.data)// 得到返回结果数据

    })

   .catch(error=>{

      console.log(error.message)

    })

想要了解跟多关于前端培训课程内容欢迎关注尚硅谷前端培训,尚硅谷除了这些技术文章外还有免费的高质量前端培训课程视频供广大学员下载学习


上一篇:
下一篇: