使用vue-resource请求数据的步骤
1.需要安装模块 vue-resource 模块
cnpm install vue-resource --save
![](https://img.haomeiwen.com/i9934063/9896959712ab7561.png)
2.在main.js 引入
import VueResource from 'vue-resource'
![](https://img.haomeiwen.com/i9934063/6c2cde8ffadd7790.png)
3.Vue.use(VueResource)
4.在组件里面直接使用
this.$http.get(地址).then(function(){
})
![](https://img.haomeiwen.com/i9934063/df92a4b6f9284239.png)
使用vue-resource请求数据的步骤
1.需要安装模块 vue-resource 模块
cnpm install vue-resource --save
2.在main.js 引入
import VueResource from 'vue-resource'
3.Vue.use(VueResource)
4.在组件里面直接使用
this.$http.get(地址).then(function(){
})
本文标题:使用vue-resource请求数据的步骤
本文链接:https://www.haomeiwen.com/subject/bbkdyqtx.html
网友评论