From f5ac981a15cc7490b18395c849665cc5822676d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Sat, 21 Oct 2023 03:42:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6style?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/chat.js b/src/chat.js index ea630f2..8d68a97 100644 --- a/src/chat.js +++ b/src/chat.js @@ -1,7 +1,6 @@ import { get, set, del, update, createStore, values } from 'idb-keyval' import { Span, Button, List, ListItem, Input, createElement } from './weigets.js' -// 先不划分频道, 只有一个公共聊天室 export default class Chat { constructor({ name, EventListeners = {}, onsend, onexit }) { this.event = { onsend, onexit } @@ -48,9 +47,8 @@ export default class Chat { }), ] })) - // 写入 css 样式到 head - const style = document.createElement('style') - style.innerText = ` + document.head.appendChild(createElement({ + innerText: ` ul.chat-list { max-height: 70vh; overflow-y: auto; @@ -68,9 +66,8 @@ export default class Chat { } ul.chat-list > li.disable { color: #888; - } - ` - document.head.appendChild(style) + }` + }, 'style')) this.载入消息() } // 收到应答(对方确认消息已被接收)