功能:自动存点通知实现滚动替换,新消息到来时自动删除旧的通知,保持包厢窗口整洁
This commit is contained in:
@@ -391,7 +391,18 @@
|
||||
msg.is_secret ||
|
||||
msg.to_user === window.chatContext.username;
|
||||
|
||||
// 自动存点通知:标记 data-autosave 属性,每次渲染时先删除旧的,实现"滚动替换"效果
|
||||
const isAutoSave = (msg.from_user === '系统' || msg.from_user === '') &&
|
||||
msg.content && msg.content.includes('自动存点');
|
||||
if (isAutoSave) {
|
||||
div.dataset.autosave = '1';
|
||||
}
|
||||
|
||||
if (isRelatedToMe) {
|
||||
// 删除旧的自动存点通知,保持包厢窗口整洁
|
||||
if (isAutoSave) {
|
||||
container2.querySelectorAll('[data-autosave="1"]').forEach(el => el.remove());
|
||||
}
|
||||
container2.appendChild(div);
|
||||
if (autoScroll) container2.scrollTop = container2.scrollHeight;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user