时间间隔小于1小时允许合并
This commit is contained in:
parent
7cc8b37d5d
commit
a641b07de1
@ -233,9 +233,8 @@ export default class Chat {
|
||||
}
|
||||
|
||||
// 如果和上一条消息是同一人, 且时间间隔小于1小时, 则向上合并
|
||||
// && new Date(time).getTime() - new Date(this.last.time).getTime() < 1000 * 60 * 60
|
||||
console.log('添加一条消息', this.last, data)
|
||||
if (this.last && this.last.name === data.name) {
|
||||
if (this.last && this.last.name === data.name && new Date(data.time).getTime() - new Date(this.last.time).getTime() < 1000 * 60 * 60) {
|
||||
this.last.item.querySelector('ul').appendChild(ListItem({ textContent: data.text }))
|
||||
this.last = { ...data, item: this.last.item }
|
||||
return this.last.item
|
||||
|
Loading…
Reference in New Issue
Block a user