From 486a9536115cd19a6457480817630784b826bc90 Mon Sep 17 00:00:00 2001 From: Suwings Date: Sat, 1 Jan 2022 10:34:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E7=A9=BA=E4=B9=8B?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/views/FileManager.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/app/views/FileManager.vue b/src/app/views/FileManager.vue index a5e9006..6c8d4a7 100644 --- a/src/app/views/FileManager.vue +++ b/src/app/views/FileManager.vue @@ -291,7 +291,8 @@ export default { try { if (this.multipleSelection.length !== 1) throw new Error("必须选择一个文件进行重命名操作"); const file = this.multipleSelection[0]; - const { value } = await this.$prompt("新的名字"); + let { value } = await this.$prompt("新的名字"); + if (!value) throw new Error("请输入一个有效值"); const oldFilePath = path.join(this.currentDir, file.name); const newFilePath = path.join(this.currentDir, value); await request({ @@ -382,6 +383,7 @@ export default { async mkdir() { const { value } = await this.$prompt("新建目录名"); try { + if (!value) throw new Error("请输入一个有效值"); const p = path.normalize(path.join(this.currentDir, value)); await request({ method: "POST", @@ -457,6 +459,7 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消" }); + if (!text.value) throw new Error("请输入一个有效值"); const zipName = text.value; for (const k in fileNames) { fileNames[k] = path.join(cwd, fileNames[k]); @@ -486,6 +489,7 @@ export default { confirmButtonText: "确定", cancelButtonText: "取消" }); + if (!text.value) throw new Error("请输入一个有效值"); const dirName = text.value; await request({ method: "POST",