Explorar o código

update 优化 如果不存在属性 则做兼容

疯狂的狮子Li hai 4 meses
pai
achega
6b2838141a
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/utils/ruoyi.ts

+ 3 - 0
src/utils/ruoyi.ts

@@ -171,6 +171,9 @@ export const handleTree = <T>(data: any[], id?: string, parentId?: string, child
   for (const d of data) {
     const id = d[config.id];
     childrenListMap[id] = d;
+    if (!d[config.childrenList]) {
+      d[config.childrenList] = [];
+    }
   }
 
   for (const d of data) {