Skip to content

Commit 4fc245e

Browse files
authored
Fix the error to get the offset value when loading 1 piece of data for chatroom (#386)
1 parent 24fe6f4 commit 4fc245e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

example/src/views/chat-room/Main.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ export default {
9898
this.$nextTick(() => {
9999
const vsl = this.$refs.vsl
100100
const offset = sids.reduce((previousValue, currentSid) => {
101-
const previousSize = typeof previousValue === 'string' ? vsl.getSize(previousValue) : previousValue
101+
const previousSize = typeof previousValue === 'string' && previousValue !== 0 ? vsl.getSize(previousValue) : previousValue
102102
return previousSize + this.$refs.vsl.getSize(currentSid)
103-
})
103+
}, 0)
104104
this.setVirtualListToOffset(offset)
105105
106106
this.param.isFetching = false

0 commit comments

Comments
 (0)