使用vue-resource请求数据的步骤

1、需要安装 vue-resource模块 注意加上--save
npm install vue-resource --save

2、main.js 引入vue-resource
import VueResource from 'vue-resource';

3、Vue.use(VueResource);

4、在组件里面直接使用
this.$http.get('url').then(function(res){},function(){err})

posted on 2019-06-22 23:24  潇潇六月雨  阅读(148)  评论(0编辑  收藏  举报

导航