Skip to content

Commit 7c809ad

Browse files
authored
fix(RecycleScroller): gridItems is undefined when scrollToItem, fix #773 (#761)
1 parent bd51403 commit 7c809ad

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/vue-virtual-scroller/src/components/RecycleScroller.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,11 @@ export default {
690690
691691
scrollToItem (index) {
692692
let scroll
693+
const gridItems = this.gridItems || 1
693694
if (this.itemSize === null) {
694695
scroll = index > 0 ? this.sizes[index - 1].accumulator : 0
695696
} else {
696-
scroll = Math.floor(index / this.gridItems) * this.itemSize
697+
scroll = Math.floor(index / gridItems) * this.itemSize
697698
}
698699
this.scrollToPosition(scroll)
699700
},

0 commit comments

Comments
 (0)