@@ -2,7 +2,7 @@ import { unref, watchEffect } from 'vue'
22import { motionValue , scroll } from 'framer-motion/dom'
33import type { ScrollInfoOptions } from '@/types'
44import { isSSR } from '@/utils/is'
5- import type { MaybeComputedElementRef , MaybeRef } from '@vueuse/core'
5+ import type { MaybeComputedElementRef } from '@vueuse/core'
66import { getElement } from '@/components/hooks/use-motion-elm'
77import type { ToRefs } from '@/types/common'
88
@@ -19,14 +19,13 @@ function createScrollMotionValues() {
1919 scrollYProgress : motionValue ( 0 ) ,
2020 }
2121}
22- export function useScroll ( scrollOptions : MaybeRef < UseScrollOptions > = { } ) {
22+ export function useScroll ( scrollOptions : UseScrollOptions = { } ) {
2323 const values = createScrollMotionValues ( )
2424
2525 watchEffect ( ( onCleanup ) => {
2626 if ( isSSR ) {
2727 return
2828 }
29- const options = unref ( scrollOptions )
3029 const cleanup = scroll (
3130 ( _progress , { x, y } ) => {
3231 values . scrollX . set ( x . current )
@@ -35,10 +34,10 @@ export function useScroll(scrollOptions: MaybeRef<UseScrollOptions> = {}) {
3534 values . scrollYProgress . set ( y . progress )
3635 } ,
3736 {
38- offset : unref ( options . offset ) ,
39- axis : unref ( options . axis ) ,
40- container : getElement ( options . container ) ,
41- target : getElement ( options . target ) ,
37+ offset : unref ( scrollOptions . offset ) ,
38+ axis : unref ( scrollOptions . axis ) ,
39+ container : getElement ( scrollOptions . container ) ,
40+ target : getElement ( scrollOptions . target ) ,
4241 } ,
4342 )
4443 onCleanup ( ( ) => {
0 commit comments