Files
directus/src/composables/use-element-size
Rijk van Zanten 70c3f05050 Interface many to one (#524)
* Start on m2o

* Render preview in m2o

* Add icons

* Style inline icons

* Add editing modal

* Disable any linter

* Add add-new button

* Pass existing selection on to layout

* Update v-table to allow for keys-only-selection

* Fix batch on tabular
2020-05-05 14:22:01 -04:00
..

useElementSize

function useElementSize(element: Element): { width: Ref<number>, height: Ref<number> }

Allows you to reactively watch an elements width and height.

Usage

<template>
	<div ref="el">
		My size is: {{ width }} x {{ height }}
	</div>
</template>

<script lang="ts">
import { defineComponent } from '@vue/composition-api';
import { useElementSize } from '@/composables/use-element-size';

export default defineComponent({
	setup(props) {
		const el = ref<Element>(null);
		const { width, height } = useElementSize(el);
		return { el, width, height };
	}
});
</script>