TextArea
This commit is contained in:
		| @@ -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 => { | ||||
|   | ||||
| @@ -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' | ||||
|   | ||||
		Reference in New Issue
	
	Block a user