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 @@ -
- - - + +
+ + @@ -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) {