Nuxt · Browser APIs

NUXT0066Use VueUse scroll and element composables

Finds VueUse project code that should use the supported use scroll and element pattern instead.

Why it happens

VueUse scroll helpers provide reactive coordinates and manage listeners across mounting, target changes, and disposal.

Fix

Use the VueUse-supported use scroll and element pattern instead.

Example

Use VueUse scroll helpers

Before

<script setup lang="ts">
const y = ref(window.scrollY)
window.addEventListener('scroll', () => { y.value = window.scrollY })
</script>

After

<script setup lang="ts">
const { y } = useWindowScroll()
</script>

Verify the fix

Run only this rule after editing so the report stays focused on the diagnostic you are closing:

pnpm nuxt doctor --rules vueuse/prefer-use-scroll-and-element
Copyright © 2026