Skip to content

Commit 6775dcb

Browse files
ellermisterbimalghartimagar
authored andcommitted
Fix the error to get the offset value when loading 1 piece of data for chatroom (tangbc#386)
1 parent febd051 commit 6775dcb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
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)