您的位置:首页 > Web前端 > Vue.js

vue 中使用axios

2017-07-24 18:31 302 查看

1.package.json 中引入axios

 

"dependencies": {
"axios": "^0.15.3",
"element-ui": "1.0.9",
"lodash.debounce": "^4.0.8",
"vue": "2.1.6",
"vue-router": "^2.1.1",
"vuex": "^2.1.2"
},
 2.vue中引入axios

 

 

Vue.prototype.axios = axios;
3.axios 方法中绑定 vue的this
}).then(function (response) {
console.log(response);
this.$router.push({ path: 'companyIndex' })
}.bind(this))
.catch(function(err){
console.log(err)
})
         
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: