Ver código fonte

删除文件夹方法添加

zhangyu 4 anos atrás
pai
commit
d463261d5a
1 arquivos alterados com 18 adições e 18 exclusões
  1. 18 18
      src/components/homeView/leftFolder.vue

+ 18 - 18
src/components/homeView/leftFolder.vue

@@ -195,24 +195,24 @@ export default {
             folder.showInput = false;
         },
         // 删除文件夹
-        handleDeleteFolder(folder) {
-            this.$confirm("此操作将永久删除该文件夹, 是否继续?", "提示", {
-                confirmButtonText: "确定",
-                cancelButtonText: "取消",
-                type: "warning",
-            })
-            .then(() => {
-                setTimeout(() => {
-                    // this.folderData.
-                    this.$message({ type: "success", message: "删除成功!"});
-                }, 1000);
-            })
-            // .catch(() => {
-            //     this.$message({
-            //         type: "info",
-            //         message: "已取消删除",
-            //     });
-            // });
+        handleDeleteFolder() {
+            if (this.rightClickFolder) {
+                this.$confirm("此操作将永久删除该文件夹, 是否继续?", "提示", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning",
+                }).then(() => {
+                    setTimeout(() => {
+                        this.folderData.splice(
+                            this.folderData.findIndex((item) => {
+                                return item.id === this.rightClickFolder.id;
+                            }),
+                            1
+                        );
+                        this.$message({ type: "success", message: "删除成功!" });
+                    }, 1000);
+                });
+            }
         },
     },
     watch: {