From dd47289f203ca481435b7e64eb3bc6d611ef0820 Mon Sep 17 00:00:00 2001 From: Taoo <1982418781@qq.com> Date: Fri, 10 Nov 2023 09:35:14 +0800 Subject: [PATCH] fix: scrollState value --- .../vue-virtual-scroller/src/components/RecycleScroller.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue index 40680cb6..7eab6f85 100644 --- a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue +++ b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue @@ -636,7 +636,9 @@ export default { const boundsSize = isVertical ? bounds.height : bounds.width let start = -(isVertical ? bounds.top : bounds.left) let size = isVertical ? window.innerHeight : window.innerWidth - if (start < 0) { + let originStart = isVertical ? bounds.top : bounds.left; + // Fix start value when the el is scrolling from under the viewport to the middle of the viewport + if (start < 0 && !(originStart > 0 && originStart < size)) { size += start start = 0 }