mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-18 02:00:10 +08:00
15 lines
322 B
TypeScript
15 lines
322 B
TypeScript
import { useRect } from '@vant/use';
|
|
import { Ref, ref, onMounted, nextTick } from 'vue';
|
|
|
|
export const useHeight = (element: Element | Ref<Element | undefined>) => {
|
|
const height = ref<number>();
|
|
|
|
onMounted(() => {
|
|
nextTick(() => {
|
|
height.value = useRect(element).height;
|
|
});
|
|
});
|
|
|
|
return height;
|
|
};
|