See scroll values in the lower right corner of the screen.
Scroll value
x: 0
y: 0

useWindowScroll

Reactive window scroll

Usage

import { useWindowScroll } from '@vueuse/core'

const { x, y } = useWindowScroll()

Type Declarations

/**
 * Reactive window scroll.
 *
 * @see /useWindowScroll
 * @param options
 */
export declare function useWindowScroll({ window }?: ConfigurableWindow): {
  x: Ref<number>
  y: Ref<number>
}
export declare type UseWindowScrollReturn = ReturnType<typeof useWindowScroll>

Source

SourceDemoDocs