Skip to content

Instantly share code, notes, and snippets.

@gearmobile
Created April 2, 2017 16:41
Show Gist options
  • Save gearmobile/d42c8cebc59645ede934279f67430d67 to your computer and use it in GitHub Desktop.
Save gearmobile/d42c8cebc59645ede934279f67430d67 to your computer and use it in GitHub Desktop.
vue.js axios
@gearmobile
You can't use `Vue.use(Axios)` because `Axios` isn't a vue plugin.
@gearmobile
Would need a wrapper like this: https://github.com/imcvampire/vue-axios
@gearmobile
You can just use `axios`, but you'd need to explicitly import it in every component you want it. If you use `vue-axios` you can do `this.axios` inside whatever component you want without explicitly importing it.
That's essentially what `vue-axios` does: https://github.com/imcvampire/vue-axios/blob/master/src/index.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment