File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ function handleClick(e) {
5050 scrollTo ( ctx . value . el || ctx . value . element , ctx . value )
5151}
5252
53- export default {
53+ const directiveHooks = {
5454 bind ( el , binding ) {
5555 getBinding ( el ) . binding = binding
5656 _ . on ( el , 'click' , handleClick )
@@ -61,7 +61,16 @@ export default {
6161 } ,
6262 update ( el , binding ) {
6363 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 ,
6574 scrollTo,
6675 bindings,
6776}
Original file line number Diff line number Diff line change @@ -4,14 +4,15 @@ import { setDefaults, scroller } from './scrollTo'
44const install = function ( Vue , options ) {
55 if ( options ) setDefaults ( options )
66 Vue . directive ( 'scroll-to' , VueScrollTo )
7- Vue . prototype . $scrollTo = VueScrollTo . scrollTo
7+ const properties = Vue . config . globalProperties || Vue . prototype
8+ properties . $scrollTo = VueScrollTo . scrollTo
89}
910
1011if ( typeof window !== 'undefined' && window . Vue ) {
1112 window . VueScrollTo = VueScrollTo
1213 window . VueScrollTo . setDefaults = setDefaults
1314 window . VueScrollTo . scroller = scroller
14- window . Vue . use ( install )
15+ if ( window . Vue . use ) window . Vue . use ( install )
1516}
1617
1718VueScrollTo . install = install
You can’t perform that action at this time.
0 commit comments