diff --git a/frontend/src/components/File/FileList.vue b/frontend/src/components/File/FileList.vue index c3f47aa1..d5c0b6ae 100644 --- a/frontend/src/components/File/FileList.vue +++ b/frontend/src/components/File/FileList.vue @@ -33,10 +33,14 @@
{ + return { + path, + expanded: this.nodeExpandedDict[path] + } + }) + .filter(d => d.expanded) + .map(d => d.path) } }, methods: { @@ -289,6 +306,13 @@ export default { this.currentFilePath = data.path this.onItemClick(data) }, + onDirClick (data, node) { + const vm = this + setTimeout(() => { + console.log(data.path, node.expanded) + vm.$set(vm.nodeExpandedDict, data.path, node.expanded) + }, 0) + }, sortFiles (nodes) { nodes.forEach(node => { if (node.is_dir) { @@ -318,6 +342,16 @@ export default { return true }) }, + computeExpanded (nodes) { + return nodes.map(node => { + if (node.is_dir) { + node.children = this.computeExpanded(node.children) + } else { + node.expanded = !!this.nodeExpandedDict[node.path] + } + return node + }) + }, isActiveFile (node) { return node.path === this.currentFilePath },