d725c1a8b9a337d111df642cb448875ab120825c.svn-base 823 B

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