File tree Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Expand file tree Collapse file tree 1 file changed +31
-7
lines changed Original file line number Diff line number Diff line change 1
- import _VirtualScroller from './components/VirtualScroller.vue'
1
+ import VirtualScroller from './components/VirtualScroller.vue'
2
2
3
- export function install ( Vue ) {
4
- Vue . component ( 'virtual-scroller' , _VirtualScroller )
3
+ export {
4
+ VirtualScroller ,
5
5
}
6
6
7
- export const VirtualScroller = _VirtualScroller
7
+ function registerComponents ( Vue , prefix ) {
8
+ Vue . component ( `${ prefix } virtual-scroller` , VirtualScroller )
9
+ }
8
10
9
- export default {
10
- /* eslint-disable no-undef */
11
+ const plugin = {
12
+ // eslint-disable-next-line no-undef
11
13
version : VERSION ,
12
- install,
14
+ install ( Vue , options ) {
15
+ const finalOptions = Object . assign ( { } , {
16
+ installComponents : true ,
17
+ componentsPrefix : '' ,
18
+ } , options )
19
+
20
+ if ( finalOptions . installComponents ) {
21
+ registerComponents ( Vue , finalOptions . componentsPrefix )
22
+ }
23
+ } ,
24
+ }
25
+
26
+ export default plugin
27
+
28
+ // Auto-install
29
+ let GlobalVue = null
30
+ if ( typeof window !== 'undefined' ) {
31
+ GlobalVue = window . Vue
32
+ } else if ( typeof global !== 'undefined' ) {
33
+ GlobalVue = global . Vue
34
+ }
35
+ if ( GlobalVue ) {
36
+ GlobalVue . use ( plugin )
13
37
}
You can’t perform that action at this time.
0 commit comments