avatar 降低点错概率

This commit is contained in:
2023-10-07 02:01:22 +08:00
parent 7e50b901c9
commit da79d6d4d7
1 changed files with 53 additions and 63 deletions

View File

@ -225,15 +225,7 @@ export default class ClientList {
add(item) { add(item) {
this.element.appendChild(ListItem({ this.element.appendChild(ListItem({
id: item.id, id: item.id,
onclick: event => { onclick: event => document.body.appendChild(Dialog({
},
children: [
Avatar({
src: item.avatar ?? '/favicon.ico',
onclick: event => {
event.stopPropagation()
// 点击插入一个弹出层
document.body.appendChild(Dialog({
children: [ children: [
Avatar({ Avatar({
src: item.avatar ?? '/favicon.ico', src: item.avatar ?? '/favicon.ico',
@ -246,7 +238,6 @@ export default class ClientList {
cursor: 'pointer' cursor: 'pointer'
}, },
onclick: event => { onclick: event => {
// 点击上传图片
console.log('点击上传图片') console.log('点击上传图片')
const input = document.createElement('input') const input = document.createElement('input')
input.type = 'file' input.type = 'file'
@ -284,14 +275,13 @@ export default class ClientList {
} }
}) })
] ]
})) })),
} children: [
Avatar({
src: item.avatar ?? '/favicon.ico'
}), }),
Span({ Span({
textContent: item.name ?? item.id, textContent: item.name ?? item.id
onclick: event => {
event.stopPropagation()
}
}) })
] ]
})) }))