UNPKG

1.15 kBJavaScriptView Raw
1"use strict";
2
3var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
4
5(function () {
6
7 /**
8 * Install plugin
9 * @param Vue
10 * @param axios
11 */
12
13 function plugin(Vue, axios) {
14
15 if (plugin.installed) {
16 return;
17 }
18 plugin.installed = true;
19
20 if (!axios) {
21 console.error('You have to install axios');
22 return;
23 }
24
25 Vue.axios = axios;
26
27 Object.defineProperties(Vue.prototype, {
28
29 axios: {
30 get: function get() {
31 return axios;
32 }
33 },
34
35 $http: {
36 get: function get() {
37 return axios;
38 }
39 }
40
41 });
42 }
43
44 if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) == "object") {
45 module.exports = plugin;
46 } else if (typeof define == "function" && define.amd) {
47 define([], function () {
48 return plugin;
49 });
50 } else if (window.Vue && window.axios) {
51 Vue.use(plugin, window.axios);
52 }
53})();
\No newline at end of file