fix(store): 修复消息推送时的去重逻辑
This commit is contained in:
parent
60dff46ffe
commit
06ce602173
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue