Skip to content

Commit e2b384c

Browse files
committed
Fixed plugin installation
1 parent d667ac9 commit e2b384c

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

index.js

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import TinyPagination from './src/components/TinyPagination.vue'
22

3-
const install = (Vue, opts ={}) => {
3+
export function install (Vue) {
4+
if (install.installed) return
5+
install.installed = true
46
Vue.component('TinyPagination', TinyPagination)
57
}
68

7-
if (typeof window !== 'undefined' && window.Vue) {
8-
install(window.Vue)
9+
const plugin = {
10+
install
911
}
1012

11-
module.exports = {
12-
version: '0.2.1-beta.7',
13-
install,
14-
TinyPagination
13+
let GlobalVue = null
14+
if (typeof window !== 'undefined') {
15+
GlobalVue = window.Vue
16+
} else if (typeof global !== 'undefined') {
17+
GlobalVue = global.Vue
18+
}
19+
if (GlobalVue) {
20+
GlobalVue.use(plugin)
1521
}
1622

17-
module.exports.default = module.exports
23+
export { TinyPagination }
24+
export default plugin

0 commit comments

Comments
 (0)