Commit 173f1c00773c8cfedd3f4c02b02942f1629fd864
1 parent
f3c6cd68
skip checking children if it was empty
Showing
2 changed files
with
3 additions
and
2 deletions
Show diff stats
examples/routers/tree.vue
src/components/tree/tree.vue
@@ -71,7 +71,7 @@ | @@ -71,7 +71,7 @@ | ||
71 | // init checked status | 71 | // init checked status |
72 | function reverseChecked(data) { | 72 | function reverseChecked(data) { |
73 | if (!data.nodeKey) data.nodeKey = key++; | 73 | if (!data.nodeKey) data.nodeKey = key++; |
74 | - if (data.children) { | 74 | + if (data.children && data.children.length) { |
75 | let checkedLength = 0; | 75 | let checkedLength = 0; |
76 | data.children.forEach(node => { | 76 | data.children.forEach(node => { |
77 | if (node.children) node = reverseChecked(node); | 77 | if (node.children) node = reverseChecked(node); |