inleft
2022-08-26 fa1bd95d533444d7360d1ada127b7a3279a3901f
commit | author | age
f9c38e 1 const VueAxios = {
I 2   vm: {},
3   // eslint-disable-next-line no-unused-vars
4   install (Vue, instance) {
5     if (this.installed) {
6       return
7     }
8     this.installed = true
9
10     if (!instance) {
11       // eslint-disable-next-line no-console
12       console.error('You have to install axios')
13       return
14     }
15
16     Vue.axios = instance
17
18     Object.defineProperties(Vue.prototype, {
19       axios: {
20         get: function get () {
21           return instance
22         }
23       },
24       $http: {
25         get: function get () {
26           return instance
27         }
28       }
29     })
30   }
31 }
32
33 export {
34   VueAxios
35 }