优化加载更多消息功能

This commit is contained in:
2026-09-30 15:19:49 +08:00
parent 0ce763cc79
commit dc734198bd
2 changed files with 8 additions and 4 deletions
+6 -2
View File
@@ -266,6 +266,8 @@ export default {
contactMessages: [],
// 首次加载
firstLoad: true,
// 每次请求加载的消息条数
pageSize: 10,
// 正在加载更多消息
loadingMore: false,
// 是否所有消息都加载完毕
@@ -348,10 +350,12 @@ export default {
// 选择联系人
async selectContact(contact) {
this.currentContact = contact;
this.loadEnd = false; //重置加载消息结束标志
this.contactMessages = [];
// 每次选择联系人的时候需要首次加载消息
this.firstLoad = true;
await this.getContactMessageList(contact.contactName, 10, 0);
await this.getContactMessageList(contact.contactName, this.pageSize, 0);
// 查看联系人后清除未读数量
contact.unreadCount = 0;
@@ -620,7 +624,7 @@ export default {
try {
await this.getContactMessageList(
this.currentContact.contactName,
10,
this.pageSize,
this.contactMessages.length
);