Skip to content

Commit

Permalink
feat: add component install on browser
Browse files Browse the repository at this point in the history
  • Loading branch information
angeliski committed Aug 27, 2019
1 parent 54f5e84 commit 12034f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
],
"main": "./dist/vue-tabulator.umd.js",
"browser": "./dist/vue-tabulator.common.js",
"unpkg": "./dist/vue-tabulator.umd.min.js",
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
Expand Down
14 changes: 10 additions & 4 deletions src/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@ import TabulatorComponent from '@/components/TabulatorComponent.vue';

export { TabulatorComponent };

function install(VueApp: typeof Vue, options: any = {}) {
const name = options.name || 'VueTabulator';
VueApp.component(name, TabulatorComponent);
};

export default {
install(VueApp: typeof Vue, options: any = {}) {
const name = options.name || 'VueTabulator';
VueApp.component(name, TabulatorComponent);
},
install,
};

if (typeof window !== 'undefined' && (<any>window).Vue && (<any>window).Vue === Vue) {
install((<any>window).Vue)
}

0 comments on commit 12034f1

Please sign in to comment.