Files
directus/app/src/composables/use-scroll-distance
Nitwel c2e7c85bbd Update documentation of app (#4222)
* move component docs to documentation

* update app docs tables for components

* update docs

* Add components to docs sidebar

* fix generated tables

* fix tables

* rename transitions

* update tables

* update nested components

* update tables

* update tables

* update tables

* update v-table table

* add basic documentation to each component

* remove all stories of storybook

* add missing documentation

* undate tables

* update tables

* update docs sidebar

* update app docs

* remove unused references

* add general readme

* update docs

* make reference titiles smaller

* add reference tag

* improve docs

* update order of tabs in sidebar

* remove all readmes and stories from interfaces/displays

* Cleanup menu

* Remove storybook

Co-authored-by: rijkvanzanten <rijkvanzanten@me.com>
2021-02-24 17:48:19 -05:00
..
2020-07-29 11:24:52 -04:00
2020-07-29 11:24:52 -04:00
2020-07-29 11:24:52 -04:00

useScrollDistance

function useScrollDistance<T extends Element>(t: T | Ref<T | null | Vue>): { 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 } from '@vue/composition-api';

export default defineComponent({
	setup() {
		const el = ref<Vue>(null);

		const { top, left } = useScrollDistance(el);

		return { el };
	}
});
</script>