vue2 数据交互 vue-resource

一、安装vue-resource到项目中,找到当前项目vue

输入:npm install vue-resource --savenpm

 

二、安装完毕后,在main.js中导入,以下所示:api

import  VueResource  from 'vue-resource'vue-resource

Vue.use(VueResource) this

 

3,数据调用spa

this.$http.get('/api/list').then((response)=>{
console.log(response.body)
})
相关文章
相关标签/搜索