Skip to content

Commit 57e7a16

Browse files
author
Guillaume Chau
committed
fix(dynamic scroller): invalidate heights instead of clear, closes #130
1 parent 9b2a658 commit 57e7a16

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/components/DynamicScroller.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default {
6262
vscrollData: {
6363
active: true,
6464
heights: {},
65+
validHeights: {},
6566
keyField: this.keyField,
6667
simpleArray: false,
6768
},
@@ -154,7 +155,9 @@ export default {
154155
},
155156
156157
forceUpdate (clear = true) {
157-
if (clear || this.simpleArray) this.vscrollData.heights = {}
158+
if (clear || this.simpleArray) {
159+
this.vscrollData.validHeights = {}
160+
}
158161
this.$emit('vscroll:update', { force: true })
159162
},
160163

src/components/DynamicScrollerItem.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export default {
4949
},
5050
5151
height () {
52-
return this.vscrollData.heights[this.id] || 0
52+
return (this.vscrollData.validHeights[this.id] && this.vscrollData.heights[this.id]) || 0
5353
},
5454
},
5555
@@ -151,6 +151,7 @@ export default {
151151
this.vscrollBus.$_undefinedMap[id] = undefined
152152
}
153153
this.$set(this.vscrollData.heights, this.id, height)
154+
this.$set(this.vscrollData.validHeights, this.id, true)
154155
if (this.emitResize) this.$emit('resize', this.id)
155156
}
156157
}

0 commit comments

Comments
 (0)