没有消息的时候,无法找到sentTime

This commit is contained in:
2022-02-16 12:06:17 +08:00
parent a88875ed55
commit 5ad72092de
2 changed files with 16 additions and 4 deletions

View File

@@ -53,7 +53,13 @@
},
computed: {
latestMessage() {
return this.messages[this.messages.length - 1]
if (this.messages.length > 1) {
return this.messages[this.messages.length - 1]
} else {
return {
sentTime: 0
}
}
}
},
onLoad(e) {

View File

@@ -61,8 +61,14 @@
}
},
computed: {
latestMessage() {
return this.messages[this.messages.length - 1]
latestMessage() {
if (this.messages.length > 1) {
return this.messages[this.messages.length - 1]
} else {
return {
sentTime: 0
}
}
}
},
onLoad(e) {
@@ -103,7 +109,7 @@
im.getMessageList(
this.conversationType,
this.targetId,
this.latestMessage.sentTime,
this.latestMessage.sentTime || 0,
1,
false,
(messages) => {