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