diff --git a/src/components/FileTree.vue b/src/components/FileTree.vue
index 782dcf5..bbc9fad 100644
--- a/src/components/FileTree.vue
+++ b/src/components/FileTree.vue
@@ -23,45 +23,56 @@
-
-
-
-
-
-
-
- {{ dataRef.name }}
-
- handleMenuClick(e, dataRef)">
- 打开
+
+
+
+
+
+
+
+
+ {{ dataRef.name }}
+
+ handleMenuClick(e, dataRef)">
+ 打开
-
-
- {{ isPinned(dataRef.path) ? "取消置顶" : "置顶" }}
-
-
+
+
+ {{ isPinned(dataRef.path) ? "取消置顶" : "置顶" }}
+
+
-
-
-
-
- 新建文件
- 新建文件夹
-
- 重命名
- 删除
+
+
+ 新建文件
+ 新建文件夹
+
+
-
- 复制路径
- 在资源管理器打开
-
-
-
-
-
-
+ 重命名
+ 删除
+
+
+ 复制路径
+ 在资源管理器打开
+
+
+
+
+
+
+
+
+ 新建文件
+ 新建文件夹
+
+ 刷新
+ 在资源管理器打开
+
+
+
@@ -362,6 +373,26 @@ const handleMenuClick = async ({ key }, node) => {
}
};
+const handleBackgroundMenuClick = ({ key }) => {
+ if (key === 'refresh') {
+ handleRefresh();
+ return;
+ }
+
+ // 构建根目录的虚拟节点
+ const separator = window.utools.isWindows() ? "\\" : "/";
+ // 注意:如果是根驱动器(如 C:\),pop() 可能为空字符串,但 state.rootPath 是完整的
+ const rootName = state.rootPath.split(separator).pop() || state.rootPath;
+
+ const rootNode = {
+ name: rootName,
+ path: state.rootPath,
+ type: "directory"
+ };
+
+ handleMenuClick({ key }, rootNode);
+};
+
const handleModalOk = async () => {
if (!modalInputValue.value) {
message.warning("请输入内容");
@@ -493,10 +524,8 @@ const handleModalOk = async () => {
}
:deep(.ant-dropdown-trigger) {
- display: flex;
flex: 1;
min-width: 0;
- align-items: center;
}
:deep(.ant-tree-node-content-wrapper:hover) {