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)
})
},