+
+
{
} else {
req.path = req.path + '/' + name;
}
- await search(req);
- if (form.isAll || form.dir) {
- selectRow.value.path = req.path;
- } else {
- selectRow.value.path = '';
- }
+ loading.value = true;
+ await search(req)
+ .then(() => {
+ loading.value = false;
+ if (form.isAll || form.dir) {
+ selectRow.value.path = req.path;
+ } else {
+ selectRow.value.path = '';
+ }
+ })
+ .catch(() => {
+ loading.value = false;
+ });
return;
}
if (!form.isAll && !form.dir) {
@@ -214,6 +227,10 @@ const openDir = async (row: File.File, column: any, event: any) => {
}
selectRow.value.path = '';
};
+const handleRowClick = (row: File.File, column: any, event: any) => {
+ debouncedOpenDir(row, column, event);
+};
+const debouncedOpenDir = debounce(openDir, 300);
const jump = async (index: number) => {
oldUrl.value = req.path;
diff --git a/frontend/src/utils/util.ts b/frontend/src/utils/util.ts
index 70cf13dbe..72fa9e065 100644
--- a/frontend/src/utils/util.ts
+++ b/frontend/src/utils/util.ts
@@ -29,6 +29,18 @@ export function randomNum(min: number, max: number): number {
return num;
}
+export function debounce(func: Function, wait: number) {
+ let timeout: NodeJS.Timeout | null = null;
+ return function executedFunction(...args: any[]) {
+ const later = () => {
+ if (timeout) clearTimeout(timeout);
+ func(...args);
+ };
+ if (timeout) clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ };
+}
+
export function getBrowserLang() {
let browserLang = navigator.language ? navigator.language : navigator.browserLanguage;
let defaultBrowserLang = '';