Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Setting root does not take effect #741

Open
noecs opened this issue Apr 13, 2020 · 6 comments
Open

Setting root does not take effect #741

noecs opened this issue Apr 13, 2020 · 6 comments

Comments

@noecs
Copy link

noecs commented Apr 13, 2020

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

@noecs
Copy link
Author

noecs commented Apr 13, 2020

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>

@IanTaite
Copy link

Setting
Vue.http.options.root = 'http://google.com';
does not seem to work either

@noecs
Copy link
Author

noecs commented Apr 13, 2020

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

@IanTaite
Copy link

IanTaite commented Apr 13, 2020 via email

@noecs
Copy link
Author

noecs commented Apr 13, 2020

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.

@noecs
Copy link
Author

noecs commented Apr 13, 2020

@IanT8 I didn't understand the links you provided. Unable to open the link.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants