From afa9edd3adbc96ce7b5bfed1fee11c3ee0241bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sat, 21 Oct 2023 15:50:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/chat.js b/src/chat.js index 3734432..0c9eb3a 100644 --- a/src/chat.js +++ b/src/chat.js @@ -185,9 +185,10 @@ export default class Chat { const id = window.crypto.randomUUID() const time = new Date().toLocaleString() const type = 'text' - this.添加元素({ id, name, text, time, type }) - this.存储消息({ id, name, text, time, type }) - this.send({ id, name, text, time, type }) + const data = { id, name, text, time, type } + this.添加元素(data) + this.存储消息(data) + this.send(data) } 收到消息(data) { console.log('收到消息', data)