'修改图片上传组件上传'

This commit is contained in:
esacpe
2025-09-26 17:29:02 +08:00
parent 26ea6dbdcf
commit 59a2581498
3 changed files with 17 additions and 3 deletions

View File

@ -10,6 +10,7 @@
:list-type="props.showBtn ? '' : 'picture-card'"
:file-list="fileList"
show-file-list
:before-remove="beforeRemove"
:on-exceed="handleExceed"
:on-success="handlerSuccess"
:before-upload="beforeImgUpload">
@ -192,6 +193,17 @@ const handlePictureCardPreview = (file) => {
const handleDownload = (file) => {
window.open(file.response.data);
};
// 删除文件 触发父组件更新
const beforeRemove = (file) => {
let index = fileList.value.findIndex(function (item) {
return item.id === file.id;
});
props.modelValue.splice(index, 1);
emits("update:modelValue", props.modelValue);
}
const handleRemove = (file) => {
let index = fileList.value.findIndex(function (item) {
return item.id === file.id;