diff --git a/src/utils/structure.ts b/src/utils/structure.ts index bba3b6a..bc647d7 100644 --- a/src/utils/structure.ts +++ b/src/utils/structure.ts @@ -45,6 +45,10 @@ if (pid.length > 1) { // 如果有多个pid,直接返回列表, 不去构造树 return plainList } + else if (pid.length === 1) { + const tree = cleanChildren(buildTree(plainList, pid[0], isSelect)) + return tree + } else { const tree = cleanChildren(buildTree(plainList, rootId, isSelect)) return tree