修改删除后文件还在的问题

This commit is contained in:
yangjun 2026-02-26 11:05:55 +08:00
parent 9932871bdc
commit e842d77112
1 changed files with 25 additions and 2 deletions

View File

@ -155,8 +155,31 @@ export default defineComponent({
});
function removeFile(index) {
uploadFileList.value.splice(index, 1);
}
// 1.
uploadFileList.value.splice(index, 1);
// 2. value
const newUrls = uploadFileList.value
.filter(file => file.status === 'done')
.map(file => {
// response
if (file.response && file.response.message) {
return file.response.message;
}
// url
return file.url ? file.url.replace(opeMediaAddress, '') : '';
})
.filter(url => url && url.trim() !== '');
// 3.
const newValue = newUrls.join(',');
state.value = newValue;
emit('update:value', newValue);
emit('change', newValue);
console.log('删除后文件列表:', uploadFileList.value);
console.log('更新后的 value:', newValue);
}
/**
* 监听value变化
*/