Sfoglia il codice sorgente

style: 删除无用代码,过长代码换行增加可读性。

Jinyao 5 anni fa
parent
commit
78bd59c4b2
1 ha cambiato i file con 4 aggiunte e 10 eliminazioni
  1. 4 10
      src/components/Tree.vue

+ 4 - 10
src/components/Tree.vue

@@ -76,15 +76,6 @@ export default {
           console.warn('需求树数据有误,树高度错误');
         }
         if (!item.parentId) rootNode = item;
-        // if (item.parent) {
-        //   const tempParent = nodeMap.get(item.parent);
-        //   if (!tempParent.childs) {
-        //     tempParent.childs = [];
-        //   }
-        //   tempParent.childs.push(item);
-        // } else {
-        //   rootNode = item;
-        // }
       });
       // 计算一个节点包含他的后代所需要的空间
       const calculateNodeContentHeight = (node) => {
@@ -92,7 +83,10 @@ export default {
           node.contentHeight = 1;
           return 1;
         }
-        node.contentHeight = node.childs.reduce((total, current) => total + calculateNodeContentHeight(current), 0);
+        node.contentHeight = node.childs.reduce(
+          (total, current) => total + calculateNodeContentHeight(current),
+          0,
+        );
         return node.contentHeight;
       };
       calculateNodeContentHeight(rootNode);