Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useWindowScroll.md
1---2category: Elements3---45# useWindowScroll67Reactive window scroll89## Usage1011```vue12<script setup lang="ts">13import { useWindowScroll } from '@vueuse/core'1415const { x, y } = useWindowScroll()16</script>1718<template>19<div>20read current x, y scroll: {{ x }}, {{ y }}21</div>22<button @click="x = 100">23scroll X to 10024</button>25<button @click="y = 100">26scroll Y to 10027</button>28</template>29```3031## Type Declarations3233```ts34export interface UseWindowScrollOptions35extends ConfigurableWindow, UseScrollOptions {}36export interface UseWindowScrollReturn extends UseScrollReturn {}37/**38* Reactive window scroll.39*40* @see https://vueuse.org/useWindowScroll41* @param options42*/43export declare function useWindowScroll(44options?: UseWindowScrollOptions,45): UseWindowScrollReturn46```47