优化加载更多消息功能
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user