From c2b7ed8d6af764d87c8a65251782f63346f4c81f Mon Sep 17 00:00:00 2001 From: Oliver <1069035666@qq.com> Date: Mon, 18 Apr 2022 08:41:51 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E6=9C=80?= =?UTF-8?q?=E5=BA=95=E9=83=A8=E5=BB=B6=E8=BF=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/VirtualScroll/src/VirtualScroll.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/VirtualScroll/src/VirtualScroll.vue b/src/components/VirtualScroll/src/VirtualScroll.vue index 6eb5874..5f6639f 100644 --- a/src/components/VirtualScroll/src/VirtualScroll.vue +++ b/src/components/VirtualScroll/src/VirtualScroll.vue @@ -111,11 +111,13 @@ () => props.items.length, () => { if (props.scrollToBottom) { - const wrapEl = unref(wrapElRef); - if (!wrapEl) { - return; - } - wrapEl.scrollTop = (props.items || []).length * unref(getItemHeightRef); + nextTick(() => { + const wrapEl = unref(wrapElRef); + if (!wrapEl) { + return; + } + wrapEl.scrollTop = unref(getContainerHeightRef); + }); } }, ); -- Gitee From 457c51c2d09776910b3f43ff3e2f5884f14b483a Mon Sep 17 00:00:00 2001 From: Oliver <1069035666@qq.com> Date: Tue, 19 Apr 2022 00:08:38 +0000 Subject: [PATCH 2/2] bug --- src/components/VirtualScroll/src/VirtualScroll.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/VirtualScroll/src/VirtualScroll.vue b/src/components/VirtualScroll/src/VirtualScroll.vue index 5f6639f..aee4bcb 100644 --- a/src/components/VirtualScroll/src/VirtualScroll.vue +++ b/src/components/VirtualScroll/src/VirtualScroll.vue @@ -116,7 +116,7 @@ if (!wrapEl) { return; } - wrapEl.scrollTop = unref(getContainerHeightRef); + wrapEl.scrollTop = (props.items || []).length * unref(getItemHeightRef); }); } }, -- Gitee