diff --git a/im-uniapp/store/chatStore.js b/im-uniapp/store/chatStore.js index 2e1ff9d..75950af 100644 --- a/im-uniapp/store/chatStore.js +++ b/im-uniapp/store/chatStore.js @@ -27,6 +27,7 @@ export default { mutations: { initChats(state, chatsData) { cacheChats = []; + state.chats = []; for (let chat of chatsData.chats) { // 已删除的会话直接丢弃 if (chat.delete) { @@ -50,7 +51,7 @@ export default { } }) }) - + console.log(cacheChats.length) }, openChat(state, chatInfo) { let chats = this.getters.findChats(); @@ -294,6 +295,7 @@ export default { }); // 将消息一次性装载回来 state.chats = cacheChats; + console.log(cacheChats.length) this.commit("saveToStorage"); }, saveToStorage(state) {