0👍
✅
You must require(‘axios’) in every component you want to use it.
But the way I prefer, is to set up Vue.prototype.$http with axios.
So, before declaring your Vue app, you declare
Vue.prototype.$http = axios
then axios will be available in any of your components without the need of importing it.
mounted: function() {
this.$http.get('/whatever').then(whatever)
...
}
Source: vue-resource retirement
Source:stackexchange.com