|
@@ -128,18 +128,21 @@ const changeGroup = (value) => {
|
|
|
};
|
|
|
// 处理文件变化
|
|
|
const handleFileChange = (file, files) => {
|
|
|
- // 检查文件类型和大小
|
|
|
- const isValidFile = validateFile(file);
|
|
|
- if (!isValidFile) {
|
|
|
- // 如果文件无效,从文件列表中移除
|
|
|
- const index = files.indexOf(file);
|
|
|
- if (index !== -1) {
|
|
|
- files.splice(index, 1);
|
|
|
+ if(file){
|
|
|
+ // 检查文件类型和大小
|
|
|
+ const isValidFile = validateFile(file);
|
|
|
+ if (!isValidFile) {
|
|
|
+ // 如果文件无效,从文件列表中移除
|
|
|
+ const index = files.indexOf(file);
|
|
|
+ if (index !== -1) {
|
|
|
+ files.splice(index, 1);
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|
|
|
- return;
|
|
|
+ fileList.value = [file];
|
|
|
+ } else {
|
|
|
+ fileList.value = [];
|
|
|
}
|
|
|
-
|
|
|
- fileList.value = [file];
|
|
|
};
|
|
|
|
|
|
// 验证文件类型和大小
|
|
@@ -194,7 +197,7 @@ const validateFile = (file) => {
|
|
|
|
|
|
// 处理文件删除
|
|
|
const handleFileRemove = (file, fileList) => {
|
|
|
- handleFileChange({}, []);
|
|
|
+ handleFileChange('', []);
|
|
|
};
|
|
|
|
|
|
// 关闭弹窗
|