删除记录
This commit is contained in:
parent
d3e2355fb3
commit
14dddbe8f5
11
src/chat.js
11
src/chat.js
@ -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)
|
||||||
|
}
|
||||||
|
})
|
||||||
]
|
]
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user