https://github.com/pagekit/vue-resource
步骤1.先修改pakejson里vue-resource版本号,然后安装
npm install vue-resource
步骤2:引入到mian.js,和vue-router用法一样
import VueResource from 'vue-resource'
Vue.use(VueResource)
步骤3:App.vue 调出mock里的seller
export default {
data() {
return {
seller: {}
}
},
created: function () {
this.$http.get('/api/seller').then((response) => {
console.log(response.body)
})
},