删除记录

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({
classList: [type],
children: [
Span({ innerText: `${name} ${time} ${text}` })
Span({ textContent: `${name} ${time} ${text}` })
]
})
this.ul.appendChild(item)
@ -96,7 +96,14 @@ export default class Chat {
添加元素(data) {
this.ul.appendChild(ListItem({
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)
}
})
]
}))
}