use axios globally in all my components vue

In main.js you can just assign Axios to $http. main.js import Axios from ‘axios’ Vue.prototype.$http = Axios; By modifying the vue prototype, any vue instance will have the ability to call $http on this. (e.g. this.$http.get(‘https://httpbin.org/get’) Note: $http is the axios object now, so any method you can call on axios object, you can call … Read more

Using Environment Variables with Vue.js

Vue.js with Webpack If you use vue cli with the Webpack template (default config), you can create and add your environment variables to a .env file. The variables will automatically be accessible under process.env.variableName in your project. Loaded variables are also available to all vue-cli-service commands, plugins and dependencies. You have a few options, this … Read more