Skip to content

Commit

Permalink
fix: 解决第二次上传同名文件不显示的问题 (1Panel-dev#4737)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengkunwang223 authored Apr 26, 2024
1 parent 29fd941 commit b0a3ecd
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions frontend/src/views/host/file-management/upload/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,27 +111,24 @@ let uploadHelper = ref('');
const em = defineEmits(['close']);
const handleClose = () => {
open.value = false;
uploadRef.value!.clearFiles();
clearFiles();
em('close', false);
};
const state = reactive({
uploadEle: null,
});
const uploaderFiles = ref<UploadFiles>([]);
const isUploadFolder = ref(false);
const hoverIndex = ref(null);
const uploadType = ref('file');
const tmpFiles = ref<UploadFiles>([]);
const breakFlag = ref(false);
const upload = (command: string) => {
uploadType.value = command;
if (command == 'dir') {
state.uploadEle.webkitdirectory = true;
} else {
state.uploadEle.webkitdirectory = false;
}
isUploadFolder.value = true;
uploadRef.value.$el.querySelector('input').value = '';
uploadRef.value.$el.querySelector('input').click();
};
Expand Down Expand Up @@ -253,10 +250,11 @@ const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
const clearFiles = () => {
uploadRef.value!.clearFiles();
uploaderFiles.value = [];
};
const handleExceed: UploadProps['onExceed'] = () => {
uploadRef.value!.clearFiles();
clearFiles();
MsgWarning(i18n.global.t('file.uploadOverLimit'));
};
Expand Down Expand Up @@ -339,8 +337,7 @@ const submit = async () => {
loading.value = false;
uploadHelper.value = '';
if (success == files.length) {
uploadRef.value!.clearFiles();
uploaderFiles.value = [];
clearFiles();
MsgSuccess(i18n.global.t('file.uploadSuccess'));
}
}
Expand Down

0 comments on commit b0a3ecd

Please sign in to comment.