UNPKG

1.12 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
19 if (!axios) {
20 console.error('You have to install axios');
21 return;
22 }
23
24 Vue.axios = axios;
25
26 Object.defineProperties(Vue.prototype, {
27
28 axios: {
29 get: function get() {
30 return axios;
31 }
32 },
33
34 $http: {
35 get: function get() {
36 return axios;
37 }
38 }
39
40 });
41 }
42
43 if ((typeof exports === "undefined" ? "undefined" : _typeof(exports)) == "object") {
44 module.exports = plugin;
45 } else if (typeof define == "function" && define.amd) {
46 define([], function () {
47 return plugin;
48 });
49 } else if (window.Vue && window.axios) {
50 Vue.use(plugin, window.axios);
51 }
52})();
\No newline at end of file