Setting root does not take effect
noecs opened this issue · comments
I use the following code, root does not take effect.
I noticed the description in the documentation. For root to take effect, you must use a relative path. However, I used a relative path, and it could not normally request my designated server address.
I tried to make a minimal example, it can reproduce my problem.
https://github.com/noecs/vuetest
Supplementary explanation:
main.js
import Vue from 'vue'
import App from './App.vue'
import VueResource from 'vue-resource';
Vue.use(VueResource);
Vue.config.productionTip = false;
new Vue({
http: {
root: 'http://google.com'
},
render: h => h(App),
}).$mount('#app');
App.vue
<template>
<div id="app">
F12 for test
<button v-on:click="onLoad">click me</button>
</div>
</template>
<script>
export default {
name: 'App',
methods: {
onLoad: function () {
this.$http.get('test');
}
}
}
</script>
Setting
Vue.http.options.root = 'http://google.com';
does not seem to work either
I checked most of the issues. This is always a problem. This package does not seem to be maintained and updated. I will use other packages as an alternative.
@IanT8
Yes, I think I will encapsulate an axios that I use. Although it is not elegant and independent of vue, it should be very effective.
@IanT8 I didn't understand the links you provided. Unable to open the link.