From 677290b89cf39d56a89dfcdf778f83e2fd0f2d0b Mon Sep 17 00:00:00 2001 From: Swapnil Date: Tue, 12 Jan 2021 18:31:27 +0530 Subject: [PATCH] fix: call vue-component inside install function --- src/components/index.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/components/index.js diff --git a/src/components/index.js b/src/components/index.js new file mode 100644 index 00000000..83f350db --- /dev/null +++ b/src/components/index.js @@ -0,0 +1,34 @@ +import GridItem from './GridItem.vue'; +import GridLayout from './GridLayout.vue'; +// import ResponsiveGridLayout from './ResponsiveGridLayout.vue'; + +const VueGridLayout = { + // ResponsiveGridLayout, + GridLayout, + GridItem, +}; + +export function install(Vue) { + if (install.installed) return; + install.installed = true; + Object.keys(VueGridLayout).forEach((name) => { + Vue.component(name, VueGridLayout[name]); + }); +} + +const plugin = { + install, +}; + +let GlobalVue = null; +if (typeof window !== 'undefined') { + GlobalVue = window.Vue; +} else if (typeof global !== 'undefined') { + GlobalVue = global.Vue; +} +if (GlobalVue) { + GlobalVue.use(plugin); +} + +export default VueGridLayout; +export { GridLayout, GridItem };