From 06ce602173a875d7d07005680970ac268fafbbab Mon Sep 17 00:00:00 2001 From: yangzhe Date: Tue, 9 Dec 2025 16:31:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(store):=20=E4=BF=AE=E5=A4=8D=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E6=8E=A8=E9=80=81=E6=97=B6=E7=9A=84=E5=8E=BB=E9=87=8D?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/store/index.js b/store/index.js index 3bdb4c7..8f8a0bd 100644 --- a/store/index.js +++ b/store/index.js @@ -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) {