This commit is contained in:
BianLzhaoMin 2025-05-23 16:18:35 +08:00
parent 5cd3ec9b98
commit 3c6d0abcc8
1 changed files with 10 additions and 13 deletions

View File

@ -137,26 +137,23 @@
} }
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 data-id="' + item.id + '" onclick="deleteFile()">删除</span>' + '</div>'
'</div>' );
)
})
} }
} }
}) })
} }
// 删除文件
function deleteFile() {
console.log('删除', $(this).data('id'))
}
getUploadFile() getUploadFile()
// 删除文件
function deleteFile(id) {
console.log('删除', id)
}
</script> </script>
</body> </body>