fix: hide folder when searching

This commit is contained in:
duanhongbo committed 2020-11-26 11:40:09 +08:00
1 parent 846a3e733d
commit 6e56594e2d
1 file changed
+6 -2
+6 -2
View File
@@ -122,7 +122,7 @@ class FileDataNode implements DataNode {
} }
removeChilds(exclude:string){ removeChilds(exclude:string){
for (let i = 0;i < this.children.length;++i) { for (let i = this.children.length-1;i >= 0;--i) {
const child = this.children[i]; const child = this.children[i];
if (child.isLeaf) { if (child.isLeaf) {
const keyStr = child.key as string; const keyStr = child.key as string;
@@ -130,9 +130,13 @@ class FileDataNode implements DataNode {
this.children.splice(i,1); this.children.splice(i,1);
} }
} else { } else {
child.removeChilds(exclude); const childLen = child.removeChilds(exclude);
if(childLen==0){
this.children.splice(i,1);
}
} }
} }
return this.children.length;
} }
// name:string; // name:string;