//cmd
npm vue-resource --save
//main.js
import VueResource from 'vue-resource'
Vue.use(VueResource)
//.vue
post:function(){
this.$http.post("url",{mydata})
.then(function(data){xxx});
}
//axios
//cmd
npm axios --axios
//main.js
import VueResource from 'vue-resource'
Vue.prototype.$http = axios // axios.post 变成 this.$http.post
//.vue
post:function(){
axios.post("url",{mydata})
.then(function(data){xxx});
}