Pref hooks (#113)

* pref: replace useContainerResize

* pref: replace useContainerScroll
This commit is contained in:
Hayden
2025-02-02 19:54:23 +08:00
committed by GitHub
parent f079d8bde5
commit faf4c15865
6 changed files with 11 additions and 116 deletions

View File

@@ -41,9 +41,7 @@
</template>
<script setup lang="ts" generic="T">
import { useDraggable } from '@vueuse/core'
import { useContainerResize } from 'hooks/resize'
import { useContainerScroll } from 'hooks/scroll'
import { useDraggable, useElementSize, useScroll } from '@vueuse/core'
import { clamp } from 'lodash'
import { computed, ref } from 'vue'
@@ -57,9 +55,9 @@ const props = defineProps<ScrollAreaProps>()
const viewport = ref<HTMLElement | null>(null)
const content = ref<HTMLElement | null>(null)
const { height: viewportHeight } = useContainerResize(viewport)
const { height: contentHeight } = useContainerResize(content)
const { y: scrollY } = useContainerScroll(viewport)
const { height: viewportHeight } = useElementSize(viewport)
const { height: contentHeight } = useElementSize(content)
const { y: scrollY } = useScroll(viewport)
const itemSize = computed(() => props.itemSize || 0)