mirror of https://github.com/fantasticit/think.git
fix: fix array to tree when parentNode is null
This commit is contained in:
parent
0970b00cb1
commit
0353d20dcf
|
@ -16,6 +16,7 @@ export function array2tree(list) {
|
||||||
list[map[node.parentDocumentId]].children.push(node);
|
list[map[node.parentDocumentId]].children.push(node);
|
||||||
} else {
|
} else {
|
||||||
node.parentDocumentId = null; // 该节点的父节点无法访问
|
node.parentDocumentId = null; // 该节点的父节点无法访问
|
||||||
|
roots.push(node);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
roots.push(node);
|
roots.push(node);
|
||||||
|
|
|
@ -816,7 +816,7 @@ export class DocumentService {
|
||||||
delete doc.state;
|
delete doc.state;
|
||||||
});
|
});
|
||||||
|
|
||||||
return array2tree(docs.map((doc) => instanceToPlain(doc)));
|
return array2tree(docs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue