Skip to content

Commit 947b4c0

Browse files
committed
refactor
1 parent 9504da6 commit 947b4c0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
(function () {
2+
13
/**
24
* Copied from vue-resource
35
*/
@@ -85,8 +87,12 @@ function plugin(Vue, axios) {
8587
});
8688
}
8789

88-
if (typeof window !== 'undefined' && window.Vue && window.axios) {
89-
window.Vue.use(plugin, window.axios);
90+
if (typeof exports == "object") {
91+
module.exports = plugin;
92+
} else if (typeof define == "function" && define.amd) {
93+
define([], function(){ return plugin });
94+
} else if (window.Vue && window.axios) {
95+
Vue.use(plugin, window.axios);
9096
}
9197

92-
export default plugin;
98+
})();

0 commit comments

Comments
 (0)