update src/utils/tree.ts.
tree.ts中的treeToString错误,修复 Signed-off-by: 口口口 <17975121@qq.com>pull/523/head
parent
0f420bf39b
commit
a57536c494
|
|
@ -374,15 +374,18 @@ export const treeToString = (tree: any[], nodeId) => {
|
|||
return node.name
|
||||
}
|
||||
let str = ''
|
||||
let list = <any[]>[]
|
||||
|
||||
function performAThoroughValidation(arr) {
|
||||
for (const item of arr) {
|
||||
if (item.id === nodeId) {
|
||||
str += ` / ${item.name}`
|
||||
list.push(item.name)
|
||||
// str += ` / ${item.name}`
|
||||
return true
|
||||
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) {
|
||||
str += ` / ${item.name}`
|
||||
// str += ` / ${item.name}`
|
||||
if (performAThoroughValidation(item.children)) {
|
||||
list.push(item.name)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
@ -391,10 +394,16 @@ export const treeToString = (tree: any[], nodeId) => {
|
|||
}
|
||||
|
||||
for (const item of tree) {
|
||||
list = []
|
||||
str = `${item.name}`
|
||||
if (performAThoroughValidation(item.children)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (list.length > 0) {
|
||||
list.reverse().forEach((name) => {
|
||||
str += ` / ${name}`
|
||||
})
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue