This commit is contained in:
2023-10-21 15:54:15 +08:00
parent afa9edd3ad
commit 99e3c0ac63
1 changed files with 4 additions and 8 deletions

View File

@ -170,15 +170,11 @@ export default class Chat {
存储消息(data) { 存储消息(data) {
set(data.id, data, this.store) set(data.id, data, this.store)
} }
载入消息() { async 载入消息() {
values(this.store).then(items => { const data = await values(this.store)
items.map(item => { data.map(item => ({ timestamp: new Date(item.time).getTime(), ...item })).sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
item.timestamp = new Date(item.time).getTime()
return item
}).sort((a, b) => a.timestamp - b.timestamp).forEach(item => {
this.添加元素(item) this.添加元素(item)
}) })
})
} }
发送消息(text) { 发送消息(text) {
const name = '我' const name = '我'