From e269d013e21844f4ed4d663d1a419f3af6324ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sun, 22 Oct 2023 20:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E6=B6=88=E6=81=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=BB=9A=E5=8A=A8=E5=88=B0=E5=BA=95=E9=83=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/chat.js b/src/chat.js index 6a24cde..273576c 100644 --- a/src/chat.js +++ b/src/chat.js @@ -208,6 +208,7 @@ export default class Chat { } return `${year}年${month}月${day}日 ${hour}:${minute}` } + const scroll = this.ul.scrollHeight === this.ul.clientHeight + this.ul.scrollTop this.ul.appendChild(ListItem({ style: { display: 'flex', @@ -244,6 +245,10 @@ export default class Chat { }) ] })) + if (scroll) { + console.log('滚动到底部') + this.ul.scrollTop = this.ul.scrollHeight + } } async 存储消息(data) { // 检查id是否已经存在