Merge pull request #1572 from rijn/1504

Skip checking children if it was empty
This commit is contained in:
Aresn 2017-08-11 13:47:11 +08:00 committed by GitHub
commit 27c86e34e1
2 changed files with 3 additions and 2 deletions

View file

@ -29,7 +29,8 @@
},
{
title: 'child2',
id: '1-2'
id: '1-2',
children: []
}
]
}

View file

@ -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);