Skip to content

Commit 62b5aea

Browse files
committed
chore: auto install plugin if global vue is available
1 parent 135a2ba commit 62b5aea

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/plugin.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
import EllipseProgress from "./components/VueEllipseProgress.vue";
1+
import VueEllipseProgress from "./components/VueEllipseProgress.vue";
2+
3+
const install = (Vue, name = "vue-ellipse-progress") => Vue.component(name, VueEllipseProgress);
4+
5+
let globalVue = null;
6+
if (typeof window !== "undefined") {
7+
globalVue = window.Vue;
8+
} else if (typeof global !== "undefined") {
9+
globalVue = global.Vue;
10+
}
11+
if (globalVue) {
12+
globalVue.use({ install });
13+
}
214

315
export default {
4-
install(Vue, name = "vue-ellipse-progress") {
5-
Vue.component(name, EllipseProgress);
6-
},
16+
install,
717
};

0 commit comments

Comments
 (0)