Vue2.x Cli3.x axios的安装和使用

安装axios到项目中,找到当前项目

npm install axios --save //or npm install axios --save-dev

安装完毕后,在main.js中导入并配置,如下所示:

//导入axios组件
import axios from 'axios'
//让$http等同于axios,实现vue-resource的无缝切换
Vue.prototype.$http = axios
Last modification:June 7th, 2019 at 03:12 pm
If you think my article is useful to you, please feel free to appreciate

Leave a Comment