Commit 27c86e34e1914d7cdf61a298745216ae3ecef053

Authored by Aresn
Committed by GitHub
2 parents f3c6cd68 173f1c00

Merge pull request #1572 from rijn/1504

Skip checking children if it was empty
Showing 2 changed files with 3 additions and 2 deletions   Show diff stats
examples/routers/tree.vue
... ... @@ -29,7 +29,8 @@
29 29 },
30 30 {
31 31 title: 'child2',
32   - id: '1-2'
  32 + id: '1-2',
  33 + children: []
33 34 }
34 35 ]
35 36 }
... ...
src/components/tree/tree.vue
... ... @@ -71,7 +71,7 @@
71 71 // init checked status
72 72 function reverseChecked(data) {
73 73 if (!data.nodeKey) data.nodeKey = key++;
74   - if (data.children) {
  74 + if (data.children && data.children.length) {
75 75 let checkedLength = 0;
76 76 data.children.forEach(node => {
77 77 if (node.children) node = reverseChecked(node);
... ...