diff --git a/src/chat.js b/src/chat.js index c2b4b17..de34354 100644 --- a/src/chat.js +++ b/src/chat.js @@ -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