diff --git a/src/utils/tree.ts b/src/utils/tree.ts index 8f1f92cc..20f97a38 100644 --- a/src/utils/tree.ts +++ b/src/utils/tree.ts @@ -276,7 +276,7 @@ export const handleTree = (data: any[], id?: string, parentId?: string, children export const handleTree2 = (data, id, parentId, children, rootId) => { id = id || 'id' parentId = parentId || 'parentId' - children = children || 'children' + // children = children || 'children' rootId = rootId || Math.min( @@ -285,16 +285,16 @@ export const handleTree2 = (data, id, parentId, children, rootId) => { }) ) || 0 - //对源数据深度克隆 + // 对源数据深度克隆 const cloneData = JSON.parse(JSON.stringify(data)) - //循环所有项 + // 循环所有项 const treeData = cloneData.filter((father) => { const branchArr = cloneData.filter((child) => { - //返回每一项的子级数组 + // 返回每一项的子级数组 return father[id] === child[parentId] }) branchArr.length > 0 ? (father.children = branchArr) : '' - //返回第一层 + // 返回第一层 return father[parentId] === rootId }) return treeData !== '' ? treeData : data diff --git a/src/views/infra/codegen/PreviewCode.vue b/src/views/infra/codegen/PreviewCode.vue index 82307d59..df521f5a 100644 --- a/src/views/infra/codegen/PreviewCode.vue +++ b/src/views/infra/codegen/PreviewCode.vue @@ -1,13 +1,20 @@