mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Fix v-table interalItems type * Fix useGroupable return type * Fix useCollection return type * Fix useCustomSelection return type * Fix useElementSize return type * Fix useFormFields return type * Fix useItem return type * Fix useItems return type * Prepend composable return type name with "Usable" * Fix usePreset return type * Fix useScrollDistance return type * Fix useTitle return type * Fix useWindowSize return type * Fix usePermissions return type * Fix useTemplateData return type * Fix a few type issues in field store * Fix extension getter return types * Fix hydrate store type issue and double-hydrating users store * Fix code interface type issue * Fix m2m composables return types * Fix html editor composables return types * Fix collections module composables return types * Fix files module composable return type * Fix settings module composable return type * Fix settings module roles composables return types * Fix settings module users composable return type * Fix return type issues in utils and a nasty parameter overwrite * Fix modelValue casing in template
useScrollDistance
function useScrollDistance<T extends Element>(
t: T | Ref<T | null | ComponentPublicInstance>
): { top: Ref<number>; left: Ref<number>; target: Element };
Returns a ref for the top and left scroll positions of the given element. Parameter supports Element, Ref, Ref, and Ref.
Usage
<template>
<v-sheet
ref="el"
style="
--v-sheet-max-width: 150px;
--v-sheet-max-height: 150px;
overflow: auto;
"
>
<div style="width: 600px; height: 600px;" />
</v-sheet>
</template>
<script lang="ts">
import { defineComponent, ComponentPublicInstance } from 'vue';
export default defineComponent({
setup() {
const el = ref<ComponentPublicInstance>(null);
const { top, left } = useScrollDistance(el);
return { el };
},
});
</script>