diff --git a/src/composition/use-rect.ts b/src/composition/use-rect.ts index 1dedbe4d1..48ebec2fb 100644 --- a/src/composition/use-rect.ts +++ b/src/composition/use-rect.ts @@ -1,4 +1,4 @@ -import { Ref, ref, onMounted } from 'vue'; +import { Ref, ref, onMounted, nextTick } from 'vue'; export const useRect = (el: Ref) => el.value.getBoundingClientRect(); @@ -6,7 +6,9 @@ export const useHeight = (el: Ref) => { const height = ref(); onMounted(() => { - height.value = useRect(el).height; + nextTick(() => { + height.value = useRect(el).height; + }); }); return height;