Browse Source

fix: 会话数量翻倍的bug

master
blue 2 years ago
parent
commit
2bcb1e2de8
  1. 4
      im-uniapp/store/chatStore.js

4
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) {

Loading…
Cancel
Save