Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion packages/vue-virtual-scroller/src/components/RecycleScroller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ export default {
},

simpleArray,
itemIndexByKey () {
const { keyField, items } = this
const result = {}
for (let i = 0, l = items.length; i < l; i++) {
result[items[i][keyField]] = i
}
return result
},
},

watch: {
Expand Down Expand Up @@ -366,6 +374,7 @@ export default {
const views = this.$_views
const unusedViews = this.$_unusedViews
const pool = this.pool
const itemIndexByKey = this.itemIndexByKey
let startIndex, endIndex
let totalSize
let visibleStartIndex, visibleEndIndex
Expand Down Expand Up @@ -493,7 +502,7 @@ export default {
if (view.nr.used) {
// Update view item index
if (checkItem) {
view.nr.index = items.indexOf(view.item)
view.nr.index = itemIndexByKey[view.item[keyField]]
}

// Check if index is still in visible range
Expand Down