我在我的nuxt 3项目上使用@vueuse的useScroll。但是useScroll似乎不起作用。这是码箱最小重现性。
// app.vue
<script setup lang="ts">
const { x:mouseX, y:mouseY } = useMouse()
const el = ref<HTMLElement | null>(null)
const { x, y, isScrolling, arrivedState, directions } = useScroll(el)
</script>
<template>
<div>Mouse pos: {{mouseX}}, {{mouseY}}</div>
<div ref="el"></div>
<NuxtWelcome /> //inserted to make the page long so we can scroll
<div>Scroll po pos: {{x}}, {{y}}</div> // here is the problem both x and y are 0,0 no matter how you scroll
<NuxtWelcome /> //inserted to make the page long so we can scroll
</template>发布于 2022-10-14 22:58:03
在我的案例样式overflow:scroll中溢出时,引用的元素需要是可滚动的。
https://stackoverflow.com/questions/74070972
复制相似问题