axios 在Vue全局引入的方法

在main.js中:

import axios form axios

Vue.prototype.$axios = axios

组件中使用:

submitFrom () {

this.$axios.getAddressJson().then(function (res){

// 成功处理

console.log(res)

},function (res) {

// 失败后处理

console.log('error'+res) 

}

}

原文地址:https://www.cnblogs.com/dujunfeng/p/8327467.html