From 34b7b5e0ddae6d8bd5df779cf464131da433e799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A5=BD=E5=A4=9A=E5=A4=A7=E7=B1=B3?= Date: Mon, 2 Aug 2021 11:16:35 +0800 Subject: [PATCH] Tree: fix insertChild (#21194) --- packages/tree/src/model/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tree/src/model/node.js b/packages/tree/src/model/node.js index 657b3b82be9..c72299582f4 100644 --- a/packages/tree/src/model/node.js +++ b/packages/tree/src/model/node.js @@ -220,7 +220,7 @@ export default class Node { if (!(child instanceof Node)) { if (!batch) { - const children = this.getChildren(true); + const children = this.getChildren(true) || []; if (children.indexOf(child.data) === -1) { if (typeof index === 'undefined' || index < 0) { children.push(child.data);