合并style

This commit is contained in:
2023-10-21 03:42:56 +08:00
parent df3500f6c5
commit f5ac981a15
1 changed files with 4 additions and 7 deletions

View File

@ -1,7 +1,6 @@
import { get, set, del, update, createStore, values } from 'idb-keyval' import { get, set, del, update, createStore, values } from 'idb-keyval'
import { Span, Button, List, ListItem, Input, createElement } from './weigets.js' import { Span, Button, List, ListItem, Input, createElement } from './weigets.js'
// 先不划分频道, 只有一个公共聊天室
export default class Chat { export default class Chat {
constructor({ name, EventListeners = {}, onsend, onexit }) { constructor({ name, EventListeners = {}, onsend, onexit }) {
this.event = { onsend, onexit } this.event = { onsend, onexit }
@ -48,9 +47,8 @@ export default class Chat {
}), }),
] ]
})) }))
// 写入 css 样式到 head document.head.appendChild(createElement({
const style = document.createElement('style') innerText: `
style.innerText = `
ul.chat-list { ul.chat-list {
max-height: 70vh; max-height: 70vh;
overflow-y: auto; overflow-y: auto;
@ -68,9 +66,8 @@ export default class Chat {
} }
ul.chat-list > li.disable { ul.chat-list > li.disable {
color: #888; color: #888;
} }`
` }, 'style'))
document.head.appendChild(style)
this.载入消息() this.载入消息()
} }
// 收到应答(对方确认消息已被接收) // 收到应答(对方确认消息已被接收)