File tree 2 files changed +14
-4
lines changed
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ function handleClick(e) {
50
50
scrollTo ( ctx . value . el || ctx . value . element , ctx . value )
51
51
}
52
52
53
- export default {
53
+ const directiveHooks = {
54
54
bind ( el , binding ) {
55
55
getBinding ( el ) . binding = binding
56
56
_ . on ( el , 'click' , handleClick )
@@ -61,7 +61,16 @@ export default {
61
61
} ,
62
62
update ( el , binding ) {
63
63
getBinding ( el ) . binding = binding
64
- } ,
64
+ }
65
+ }
66
+
67
+ export default {
68
+ bind : directiveHooks . bind ,
69
+ unbind : directiveHooks . unbind ,
70
+ update : directiveHooks . update ,
71
+ beforeMount : directiveHooks . bind ,
72
+ unmounted : directiveHooks . unbind ,
73
+ updated : directiveHooks . update ,
65
74
scrollTo,
66
75
bindings,
67
76
}
Original file line number Diff line number Diff line change @@ -4,14 +4,15 @@ import { setDefaults, scroller } from './scrollTo'
4
4
const install = function ( Vue , options ) {
5
5
if ( options ) setDefaults ( options )
6
6
Vue . directive ( 'scroll-to' , VueScrollTo )
7
- Vue . prototype . $scrollTo = VueScrollTo . scrollTo
7
+ const properties = Vue . config . globalProperties || Vue . prototype
8
+ properties . $scrollTo = VueScrollTo . scrollTo
8
9
}
9
10
10
11
if ( typeof window !== 'undefined' && window . Vue ) {
11
12
window . VueScrollTo = VueScrollTo
12
13
window . VueScrollTo . setDefaults = setDefaults
13
14
window . VueScrollTo . scroller = scroller
14
- window . Vue . use ( install )
15
+ if ( window . Vue . use ) window . Vue . use ( install )
15
16
}
16
17
17
18
VueScrollTo . install = install
You can’t perform that action at this time.
0 commit comments