فهرست منبع

feat: 支持传入空数组

zhangweicheng 5 سال پیش
والد
کامیت
77028bda5f
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  1. 1 1
      tree/src/index.ts

+ 1 - 1
tree/src/index.ts

@@ -96,7 +96,7 @@ export class Tree {
 
   // 获取顶层原始数据
   getRoots(): TreeNode[] {
-    return this.parentMap[this.rootID];
+    return this.parentMap[this.rootID] || [];
   }
 
   // 生成按照树结构排好序的数据