`

vue 中使用axios

阅读更多

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)
            })
 
 
 
 
 
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics