Created
April 2, 2017 16:41
-
-
Save gearmobile/d42c8cebc59645ede934279f67430d67 to your computer and use it in GitHub Desktop.
vue.js axios
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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