对话框

This commit is contained in:
2023-10-21 05:50:17 +08:00
parent 14dddbe8f5
commit 6a244555d6
2 changed files with 25 additions and 1 deletions

View File

@ -95,9 +95,27 @@ export default class Chat {
} }
添加元素(data) { 添加元素(data) {
this.ul.appendChild(ListItem({ this.ul.appendChild(ListItem({
style: {
display: 'flex',
justifyContent: 'space-between',
alignItems: 'center',
margin: '1rem',
padding: '.5rem 1rem',
boxSizing: 'border-box',
boxShadow: '0 0 1rem #eee',
maxWidth: '24rem',
borderRadius: '1rem',
},
children: [ children: [
Span({ textContent: `${data.name} ${data.time} ${data.text}` }), Span({ textContent: `${data.name} ${data.time} ${data.text}` }),
Button({ Button({
style: {
boxSizing: 'border-box',
boxShadow: '0 0 1rem #eee',
borderRadius: '1rem',
fontSize: '12px',
color: '#555'
},
textContent: '删除', textContent: '删除',
onclick: event => { onclick: event => {
event.target.parentNode.remove() event.target.parentNode.remove()

View File

@ -28,7 +28,13 @@ export function Span(options) {
} }
export function Button(options) { export function Button(options) {
return createElement(options, 'button') return createElement({
...options,
style: {
cursor: 'pointer',
...options.style
}
}, 'button')
} }
export function Input(options) { export function Input(options) {