This commit is contained in:
2023-10-21 15:50:14 +08:00
parent 77fd29efb4
commit afa9edd3ad
1 changed files with 4 additions and 3 deletions

View File

@ -185,9 +185,10 @@ export default class Chat {
const id = window.crypto.randomUUID() const id = window.crypto.randomUUID()
const time = new Date().toLocaleString() const time = new Date().toLocaleString()
const type = 'text' const type = 'text'
this.添加元素({ id, name, text, time, type }) const data = { id, name, text, time, type }
this.存储消息({ id, name, text, time, type }) this.添加元素(data)
this.send({ id, name, text, time, type }) this.存储消息(data)
this.send(data)
} }
收到消息(data) { 收到消息(data) {
console.log('收到消息', data) console.log('收到消息', data)