I am using axios for AJAX in Vue. In the article written by You, he mentioned that we can set Vue.prototype.$http = axios and I can use this.$http in Vue instance. It works fine.
However, if I want to create an axios instance to $http, like
Vue.prototype.$http = axios.create({
baseURL: 'https://app.herokuapp.com/'
})
It does not work when I use this.$http.get('/relativeURL'). It seems that it cannot access the config I set. That is, it will not send request to https://app.herokuapp.com/relativeURL
In another way, if I set axios instance in any other object, such as Vue.prototype.$axios = axios.create({config}). It works successfully.
Could someone explain why this happen ??