优化文件浏览器组件,修复目录树切换逻辑

This commit is contained in:
jxxghp
2025-04-03 08:23:07 +08:00
parent 12356abf00
commit e3a385c989
2 changed files with 15 additions and 17 deletions
+10 -13
View File
@@ -168,7 +168,7 @@ function sortChanged(s: string) {
// 切换目录树 // 切换目录树
function switchDirTree(state: boolean) { function switchDirTree(state: boolean) {
showDirTree.value = !state showDirTree.value = state
} }
// 文件列表 // 文件列表
@@ -210,18 +210,15 @@ const fileListStyle = computed(() => {
@sortchanged="sortChanged" @sortchanged="sortChanged"
/> />
<div class="flex" :style="scrollStyle"> <div class="flex" :style="scrollStyle">
<VSlideXTransition v-if="showDirTree"> <FileNavigator
<div> v-if="showDirTree"
<FileNavigator :storage="activeStorage"
:storage="activeStorage" :currentPath="item.path"
:currentPath="item.path" :items="fileListItems"
:items="fileListItems" :endpoints="endpoints"
:endpoints="endpoints" :axios="axios"
:axios="axios" @navigate="pathChanged"
@navigate="pathChanged" />
/>
</div>
</VSlideXTransition>
<FileList <FileList
class="flex-grow" class="flex-grow"
:item="item" :item="item"
+5 -4
View File
@@ -379,8 +379,8 @@ function formatTime(timestape: number) {
} }
// 切换文件树显示 // 切换文件树显示
function switchFileTree() { function switchFileTree(state: boolean) {
emit('switch-tree', inProps.showTree) emit('switch-tree', state)
} }
// 监听refreshPending变化 // 监听refreshPending变化
@@ -549,8 +549,9 @@ onMounted(() => {
<template> <template>
<VCard class="d-flex flex-column w-full h-full"> <VCard class="d-flex flex-column w-full h-full">
<VToolbar v-if="!loading" density="compact" flat color="gray"> <VToolbar v-if="!loading" density="compact" flat color="gray">
<IconBtn> <IconBtn v-if="display.mdAndUp.value">
<VIcon :icon="showTree ? 'mdi-file-tree' : 'mdi-file-tree-outline'" @@click="switchFileTree" /> <VIcon v-if="showTree" icon="mdi-file-tree" @click="switchFileTree(false)" />
<VIcon v-else icon="mdi-file-tree-outline" @click="switchFileTree(true)" />
</IconBtn> </IconBtn>
<VTextField <VTextField
v-if="!isFile" v-if="!isFile"