diff --git a/src/components/FileTree.vue b/src/components/FileTree.vue index b442025..5d61ca6 100644 --- a/src/components/FileTree.vue +++ b/src/components/FileTree.vue @@ -76,7 +76,7 @@ - + @@ -102,6 +102,15 @@ const currentNode = ref(null); const searchKeyword = ref(""); const selectedKeys = ref([]); const treeContentRef = ref(null); +const modalInputRef = ref(null); + +watch(modalVisible, (val) => { + if (val) { + nextTick(() => { + modalInputRef.value?.focus(); + }); + } +}); // 监听 activeTab 变化,实现联动 watch( @@ -374,7 +383,7 @@ const handleMenuClick = async ({ key }, node) => { }; const handleBackgroundMenuClick = ({ key }) => { - if (key === 'refresh') { + if (key === "refresh") { handleRefresh(); return; } @@ -383,11 +392,11 @@ const handleBackgroundMenuClick = ({ key }) => { 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" + type: "directory", }; handleMenuClick({ key }, rootNode);