fix(store): 修复消息推送时的去重逻辑

This commit is contained in:
yangzhe 2025-12-09 16:31:45 +08:00
parent 60dff46ffe
commit 06ce602173
1 changed files with 8 additions and 8 deletions

View File

@ -178,14 +178,14 @@ const store = new Vuex.Store({
}, },
// 推送一条新消息(去重) // 推送一条新消息(去重)
push_Msg(state, msg) { push_Msg(state, msg) {
// 注现在的消息没有id暂时注释 // 注现在的消息没有id无法去重暂时用push_MsgList
// if (!msg || !msg.id) return; if (!msg || !msg.id) return;
// const exists = (state.vuex_msgList || []).some( const exists = (state.vuex_msgList || []).some(
// (item) => item && item.id === msg.id (item) => item && item.id === msg.id
// ); );
// if (!exists) { if (!exists) {
state.vuex_msgList.push(msg); state.vuex_msgList.push(msg);
// } }
}, },
// 插入历史消息到头部 // 插入历史消息到头部
unshift_Msg(state, msg) { unshift_Msg(state, msg) {