Commit b5aa9d24 by 山野羡民 Committed by Gitee

防御性编程,规避服务端children返回的不是数组时…… update src/utils/tree.ts.

Signed-off-by: 山野羡民 <liyujiang_tk@yeah.net>
parent e891a4bf
...@@ -376,6 +376,9 @@ export const treeToString = (tree: any[], nodeId) => { ...@@ -376,6 +376,9 @@ export const treeToString = (tree: any[], nodeId) => {
let str = '' let str = ''
function performAThoroughValidation(arr) { function performAThoroughValidation(arr) {
if (typeof arr === 'undefined' || !Array.isArray(arr) || arr.length === 0) {
return false
}
for (const item of arr) { for (const item of arr) {
if (item.id === nodeId) { if (item.id === nodeId) {
str += ` / ${item.name}` str += ` / ${item.name}`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment