This commit is contained in:
2023-10-21 03:48:03 +08:00
parent f5ac981a15
commit ea397c735b
2 changed files with 7 additions and 3 deletions

View File

@ -1,5 +1,5 @@
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, TextArea, createElement } from './weigets.js'
export default class Chat {
constructor({ name, EventListeners = {}, onsend, onexit }) {
@ -10,7 +10,7 @@ export default class Chat {
document.body.appendChild(createElement({
children: [
this.ul,
createElement({
TextArea({
type: 'text',
placeholder: '输入聊天内容',
style: {
@ -27,7 +27,7 @@ export default class Chat {
event.target.value = ''
}
}
}, 'textarea'),
}),
Button({
textContent: '发送(ctrl+Enter)',
onclick: event => {

View File

@ -35,6 +35,10 @@ export function Input(options) {
return createElement(options, 'input')
}
export function TextArea(options) {
return createElement(options, 'textarea')
}
export function Avatar(options) {
const element = createElement(options, 'img')
element.onerror = () => element.src = '/favicon.ico'