From 7c809ad1d612824867490c7bd5ce2861110412eb Mon Sep 17 00:00:00 2001 From: Crs Date: Wed, 14 Dec 2022 17:59:59 +0800 Subject: [PATCH] fix(RecycleScroller): gridItems is undefined when scrollToItem, fix #773 (#761) --- .../vue-virtual-scroller/src/components/RecycleScroller.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue index 62e398ee..ea056bd9 100644 --- a/packages/vue-virtual-scroller/src/components/RecycleScroller.vue +++ b/packages/vue-virtual-scroller/src/components/RecycleScroller.vue @@ -690,10 +690,11 @@ export default { scrollToItem (index) { let scroll + const gridItems = this.gridItems || 1 if (this.itemSize === null) { scroll = index > 0 ? this.sizes[index - 1].accumulator : 0 } else { - scroll = Math.floor(index / this.gridItems) * this.itemSize + scroll = Math.floor(index / gridItems) * this.itemSize } this.scrollToPosition(scroll) },