Blame view

ant-design-vue-jeecg/src/utils/axios.js 677 Bytes
肖超群 authored
1
const VueAxios = {
肖超群 authored
2
3
4
5
6
7
8
  vm: {},
  // eslint-disable-next-line no-unused-vars
  install(Vue, router = {}, instance) {
    if (this.installed) {
      return;
    }
    this.installed = true;
肖超群 authored
9
肖超群 authored
10
11
12
13
14
    if (!instance) {
      // eslint-disable-next-line no-console
      console.error('You have to install axios');
      return;
    }
肖超群 authored
15
肖超群 authored
16
    Vue.axios = instance;
肖超群 authored
17
肖超群 authored
18
19
20
21
22
23
24
25
26
27
28
29
30
    Object.defineProperties(Vue.prototype, {
      axios: {
        get: function get() {
          return instance;
        }
      },
      $http: {
        get: function get() {
          return instance;
        }
      }
    });
  }
肖超群 authored
31
32
33
};

export {
肖超群 authored
34
35
36
  VueAxios,
  // eslint-disable-next-line no-undef
  //instance as axios
肖超群 authored
37
}