diff --git a/examples/routers/tree.vue b/examples/routers/tree.vue index 98fc8f74..b053f222 100644 --- a/examples/routers/tree.vue +++ b/examples/routers/tree.vue @@ -29,7 +29,8 @@ }, { title: 'child2', - id: '1-2' + id: '1-2', + children: [] } ] } diff --git a/src/components/tree/tree.vue b/src/components/tree/tree.vue index f6b5e222..51134175 100644 --- a/src/components/tree/tree.vue +++ b/src/components/tree/tree.vue @@ -71,7 +71,7 @@ // init checked status function reverseChecked(data) { if (!data.nodeKey) data.nodeKey = key++; - if (data.children) { + if (data.children && data.children.length) { let checkedLength = 0; data.children.forEach(node => { if (node.children) node = reverseChecked(node);