fix(store): 修复消息推送时的去重逻辑
This commit is contained in:
parent
60dff46ffe
commit
06ce602173
|
|
@ -178,14 +178,14 @@ const store = new Vuex.Store({
|
|||
},
|
||||
// 推送一条新消息(去重)
|
||||
push_Msg(state, msg) {
|
||||
// 注:现在的消息没有id,暂时注释
|
||||
// if (!msg || !msg.id) return;
|
||||
// const exists = (state.vuex_msgList || []).some(
|
||||
// (item) => item && item.id === msg.id
|
||||
// );
|
||||
// if (!exists) {
|
||||
state.vuex_msgList.push(msg);
|
||||
// }
|
||||
// 注:现在的消息没有id,无法去重,暂时用push_MsgList
|
||||
if (!msg || !msg.id) return;
|
||||
const exists = (state.vuex_msgList || []).some(
|
||||
(item) => item && item.id === msg.id
|
||||
);
|
||||
if (!exists) {
|
||||
state.vuex_msgList.push(msg);
|
||||
}
|
||||
},
|
||||
// 插入历史消息到头部
|
||||
unshift_Msg(state, msg) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue