diff --git a/frontend/src/views/host/file-management/hooks/searchable.ts b/frontend/src/views/host/file-management/hooks/searchable.ts index 91f4d353a..0b1e0c0f1 100644 --- a/frontend/src/views/host/file-management/hooks/searchable.ts +++ b/frontend/src/views/host/file-management/hooks/searchable.ts @@ -58,10 +58,12 @@ export function useMultipleSearchable(paths) { const searchableStatus = ref(false); const searchablePath = ref(''); const searchableInputRefs = ref>({}); - const setSearchableInputRef = (id: string, el: HTMLInputElement | null) => { if (el) { searchableInputRefs.value[id] = el; + nextTick(() => { + searchableInputRefs.value[id]?.focus(); + }); } else { delete searchableInputRefs.value[id]; } @@ -70,13 +72,6 @@ export function useMultipleSearchable(paths) { watch(searchableStatus, (val) => { if (val) { searchablePath.value = paths.value.at(-1)?.url || ''; - nextTick(() => { - const keys = Object.keys(searchableInputRefs.value); - if (keys.length > 0) { - const lastKey = keys[keys.length - 1]; - searchableInputRefs.value[lastKey]?.focus(); - } - }); } }); diff --git a/frontend/src/views/host/file-management/index.vue b/frontend/src/views/host/file-management/index.vue index 798901549..a542d5366 100644 --- a/frontend/src/views/host/file-management/index.vue +++ b/frontend/src/views/host/file-management/index.vue @@ -626,7 +626,7 @@ - + @@ -1417,6 +1417,10 @@ const openPaste = () => { moveRef.value.acceptParams(fileMove); }; +function onLoading(isLoading: boolean) { + loading.value = isLoading; +} + const openDownload = (file: File.File) => { downloadFile(file.path, globalStore.currentNode); }; diff --git a/frontend/src/views/host/file-management/move/index.vue b/frontend/src/views/host/file-management/move/index.vue index a921cc162..8d48533c3 100644 --- a/frontend/src/views/host/file-management/move/index.vue +++ b/frontend/src/views/host/file-management/move/index.vue @@ -121,7 +121,7 @@ const rules = reactive({ name: [Rules.requiredInput], }); -const em = defineEmits(['close']); +const em = defineEmits(['close', 'loading']); const handleClose = (search: boolean) => { open.value = false; @@ -169,6 +169,8 @@ const changeType = () => { }; const mvFile = () => { + loading.value = true; + em('loading', true); moveFile(addForm) .then(() => { if (type.value === 'cut') { @@ -180,6 +182,7 @@ const mvFile = () => { }) .finally(() => { loading.value = false; + em('loading', false); }); };