From 4beed1531f8faf942797d0192cf4e62a6658b4ea Mon Sep 17 00:00:00 2001 From: Seven <1530011482@qq.com> Date: Tue, 22 Sep 2026 14:17:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/index/ChatPage.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/index/ChatPage.vue b/src/pages/index/ChatPage.vue index 130567e..ba6522a 100644 --- a/src/pages/index/ChatPage.vue +++ b/src/pages/index/ChatPage.vue @@ -403,16 +403,18 @@ export default { this.$set(this.contactMessages, this.currentContact.contactName, []); } + // 新消息 const newMessage = { senderName: this.currentUser.username, receiverName: this.currentContact.contactName, content: content, + createdAt: new Date() }; sendMessage(newMessage) .then((response) => { console.log("发送消息成功", response.data); - this.contactMessages[this.currentContact.contactName].push({ + this.contactMessages.push({ ...newMessage, from: "me", }); @@ -432,6 +434,7 @@ export default { this.recentChats.splice(index, 1); this.recentChats.unshift(chat); + console.log(this.recentChats) } else { // 没有找到这条数据,直接添加到数组最前面 this.recentChats.unshift({