1.下载
npm install
npm install vue-axios --save
2. 引用
import axios from 'axios'
Vue.prototype.$axios = axios //全局注册,使用方法为:this.$axios
3.使用
this.$axios
.post("地址", {
username: this.inputName,
password: this.inputPassword,
})
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});