Webpack: how do add vue-resource?

Created on 25 Dec 2016  路  2Comments  路  Source: vuejs-templates/webpack

I have no idea how to make an http call, people tell me to use vue-resource but I'm unclear how to add it to my project. I used the vue-cli webpack template to generate my project.

Most helpful comment

  1. Installing vue-resource via npm
  2. Add code in src/main.js
import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource);
  1. vue-resource is available in vue instance now: this.$http

All 2 comments

  1. Installing vue-resource via npm
  2. Add code in src/main.js
import Vue from 'vue'
import VueResource from 'vue-resource'
Vue.use(VueResource);
  1. vue-resource is available in vue instance now: this.$http

THANKS

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolas-t picture nicolas-t  路  4Comments

exarus picture exarus  路  3Comments

paulgeisler picture paulgeisler  路  3Comments

dfdgsdfg picture dfdgsdfg  路  4Comments

akoboy picture akoboy  路  3Comments