Skip to content

Commit e2384fc

Browse files
committed
Fix scrollToItem
1 parent 6408d57 commit e2384fc

File tree

5 files changed

+11
-12
lines changed

5 files changed

+11
-12
lines changed

dist/vue-virtual-scroller.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/build.js

Lines changed: 7 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/build.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-virtual-scroller",
33
"description": "Smooth scrolling for any amount of data",
4-
"version": "0.7.0",
4+
"version": "0.7.1",
55
"author": {
66
"name": "Guillaume Chau",
77
"email": "[email protected]"

src/components/VirtualScroller.vue

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,7 @@ export default {
234234
scrollToItem (index) {
235235
let scrollTop
236236
if (this.itemHeight === null) {
237-
scrollTop = 0
238-
for (let i = 0; i < index; i++) {
239-
scrollTop += this.items[i][this.heightField]
240-
}
237+
scrollTop = index > 0 ? this.heights[index - 1] : 0
241238
} else {
242239
scrollTop = index * this.itemHeight
243240
}

0 commit comments

Comments
 (0)