支持 cros、jsonp跨域;
1.安装
cnpm install vue-resource --save
2.在main.js中导入
import vueResource from 'vue-resource';
Vue.use(vueResource);
3.调用接口
mounted(){
this.$http.post(api).then((res)=>{
console.log(res)
})
}
支持 cros、jsonp跨域;
1.安装
cnpm install vue-resource --save
2.在main.js中导入
import vueResource from 'vue-resource';
Vue.use(vueResource);
3.调用接口
mounted(){
this.$http.post(api).then((res)=>{
console.log(res)
})
}