删除记录

This commit is contained in:
2023-10-21 05:09:32 +08:00
parent d3e2355fb3
commit 14dddbe8f5
1 changed files with 9 additions and 2 deletions

View File

@ -81,7 +81,7 @@ export default class Chat {
const item = ListItem({ const item = ListItem({
classList: [type], classList: [type],
children: [ children: [
Span({ innerText: `${name} ${time} ${text}` }) Span({ textContent: `${name} ${time} ${text}` })
] ]
}) })
this.ul.appendChild(item) this.ul.appendChild(item)
@ -96,7 +96,14 @@ export default class Chat {
添加元素(data) { 添加元素(data) {
this.ul.appendChild(ListItem({ this.ul.appendChild(ListItem({
children: [ children: [
Span({ innerText: `${data.name} ${data.time} ${data.text}` }) Span({ textContent: `${data.name} ${data.time} ${data.text}` }),
Button({
textContent: '删除',
onclick: event => {
event.target.parentNode.remove()
del(data.id, this.store)
}
})
] ]
})) }))
} }