This commit is contained in:
BianLzhaoMin 2025-05-23 16:20:40 +08:00
parent 3c6d0abcc8
commit 946f9f41ec
1 changed files with 13 additions and 8 deletions

View File

@ -137,12 +137,14 @@
} }
if (res.obj && res.obj.length > 0) { if (res.obj && res.obj.length > 0) {
$('.password-book-list').empty() $('.password-book-list').empty()
res.obj.forEach(item => {
$('.password-book-list').append( $('.password-book-list').append(
'<div class="password-book-item">' + '<div class="password-book-item">' +
'<span>' + item.fileName + '</span>' + '<span>' + item.fileName + '</span>' +
`<span onclick="deleteFile('${item.id}')">删除</span>` + // 直接传 id `<span onclick="deleteFile('${item.id}')">删除</span>` + // 直接传 id
'</div>' '</div>'
); );
})
} }
} }
}) })
@ -151,10 +153,13 @@
getUploadFile() getUploadFile()
// 删除文件 // 删除文件
function deleteFile(id) { function deleteFile() {
console.log('删除', id) console.log('删除', $(this).data('id'))
} }
</script> </script>
</body> </body>