From 172bbab475fb6d27162999f9bd90b378effc061a Mon Sep 17 00:00:00 2001 From: Fatpandac Date: Fri, 29 Dec 2023 17:38:10 +0800 Subject: [PATCH] fix(vc-virtual-list): onMounted cannot got the offsetHeight --- components/vc-virtual-list/List.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/vc-virtual-list/List.tsx b/components/vc-virtual-list/List.tsx index 3cacd6db44..c0683422ce 100644 --- a/components/vc-virtual-list/List.tsx +++ b/components/vc-virtual-list/List.tsx @@ -190,8 +190,9 @@ const List = defineComponent({ const offsetHeight = shallowRef(0); onMounted(() => { - nextTick(() => { + const timer = setTimeout(() => { offsetHeight.value = fillerInnerRef.value?.offsetHeight || 0; + clearTimeout(timer); }); }); onUpdated(() => {