TextArea
This commit is contained in:
parent
f5ac981a15
commit
ea397c735b
@ -1,5 +1,5 @@
|
|||||||
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, TextArea, createElement } from './weigets.js'
|
||||||
|
|
||||||
export default class Chat {
|
export default class Chat {
|
||||||
constructor({ name, EventListeners = {}, onsend, onexit }) {
|
constructor({ name, EventListeners = {}, onsend, onexit }) {
|
||||||
@ -10,7 +10,7 @@ export default class Chat {
|
|||||||
document.body.appendChild(createElement({
|
document.body.appendChild(createElement({
|
||||||
children: [
|
children: [
|
||||||
this.ul,
|
this.ul,
|
||||||
createElement({
|
TextArea({
|
||||||
type: 'text',
|
type: 'text',
|
||||||
placeholder: '输入聊天内容',
|
placeholder: '输入聊天内容',
|
||||||
style: {
|
style: {
|
||||||
@ -27,7 +27,7 @@ export default class Chat {
|
|||||||
event.target.value = ''
|
event.target.value = ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, 'textarea'),
|
}),
|
||||||
Button({
|
Button({
|
||||||
textContent: '发送(ctrl+Enter)',
|
textContent: '发送(ctrl+Enter)',
|
||||||
onclick: event => {
|
onclick: event => {
|
||||||
|
@ -35,6 +35,10 @@ export function Input(options) {
|
|||||||
return createElement(options, 'input')
|
return createElement(options, 'input')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function TextArea(options) {
|
||||||
|
return createElement(options, 'textarea')
|
||||||
|
}
|
||||||
|
|
||||||
export function Avatar(options) {
|
export function Avatar(options) {
|
||||||
const element = createElement(options, 'img')
|
const element = createElement(options, 'img')
|
||||||
element.onerror = () => element.src = '/favicon.ico'
|
element.onerror = () => element.src = '/favicon.ico'
|
||||||
|
Loading…
Reference in New Issue
Block a user