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) {
$('.password-book-list').empty()
res.obj.forEach(item => {
$('.password-book-list').append(
'<div class="password-book-item">' +
'<span>' + item.fileName + '</span>' +
'<span data-id="' + item.id + '" onclick="deleteFile()">删除</span>' +
`<span onclick="deleteFile('${item.id}')">删除</span>` + // 直接传 id
'</div>'
)
})
);
}
}
})
}
// 删除文件
function deleteFile() {
console.log('删除', $(this).data('id'))
}
getUploadFile()
// 删除文件
function deleteFile(id) {
console.log('删除', id)
}
</script>
</body>