You must try this via frontend side:(您必须通过前端尝试此操作:)
const nestedChild = (itemArray, dependancyTaskId = null) => {
const responseArray = []
for(let i in itemArray) {
if(itemArray[i].dependancyTaskId == dependancyTaskId) {
const children = nestedChild(itemArray, itemArray[i].taskId)
if(children.length) {
itemArray[i].children = children
}
responseArray.push(itemArray[i])
}
}
return responseArray
}
const response = nestedChild(tasks);
Now you can traverse and print it in unordered list and can format it via css.(现在,您可以遍历并将其打印在无序列表中,并可以通过CSS对其进行格式化。)
Hope this will help you much.(希望这对您有帮助。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…