mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-09-05 23:56:42 +08:00
fix: expand path directories on row click
This commit is contained in:
@@ -103,8 +103,21 @@ const selectedPath = computed(() => {
|
|||||||
return ''
|
return ''
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function isFileItem(value: unknown): value is FileItem {
|
||||||
|
return typeof value === 'object' && value !== null && 'path' in value && 'type' in value
|
||||||
|
}
|
||||||
|
|
||||||
|
function activateDir({ id }: { id: unknown }) {
|
||||||
|
const item = isFileItem(id) ? id : typeof id === 'string' ? findPath(treeItems.value[0], id) : null
|
||||||
|
|
||||||
|
if (!item || item.type !== 'dir') return
|
||||||
|
|
||||||
|
activedDirs.value = [item]
|
||||||
|
}
|
||||||
|
|
||||||
watch(activedDirs, newVal => {
|
watch(activedDirs, newVal => {
|
||||||
if (!newVal.length) return
|
if (!newVal.length) return
|
||||||
|
|
||||||
emit('update:modelValue', selectedPath.value)
|
emit('update:modelValue', selectedPath.value)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -165,8 +178,10 @@ watch(
|
|||||||
activatable
|
activatable
|
||||||
return-object
|
return-object
|
||||||
max-height="20rem"
|
max-height="20rem"
|
||||||
|
open-on-click
|
||||||
expand-icon="mdi-folder"
|
expand-icon="mdi-folder"
|
||||||
collapse-icon="mdi-folder-open"
|
collapse-icon="mdi-folder-open"
|
||||||
|
@click:open="activateDir"
|
||||||
/>
|
/>
|
||||||
</VMenu>
|
</VMenu>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user