skip checking children if it was empty
This commit is contained in:
parent
f3c6cd68d1
commit
173f1c0077
2 changed files with 3 additions and 2 deletions
|
@ -29,7 +29,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'child2',
|
title: 'child2',
|
||||||
id: '1-2'
|
id: '1-2',
|
||||||
|
children: []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
// init checked status
|
// init checked status
|
||||||
function reverseChecked(data) {
|
function reverseChecked(data) {
|
||||||
if (!data.nodeKey) data.nodeKey = key++;
|
if (!data.nodeKey) data.nodeKey = key++;
|
||||||
if (data.children) {
|
if (data.children && data.children.length) {
|
||||||
let checkedLength = 0;
|
let checkedLength = 0;
|
||||||
data.children.forEach(node => {
|
data.children.forEach(node => {
|
||||||
if (node.children) node = reverseChecked(node);
|
if (node.children) node = reverseChecked(node);
|
||||||
|
|
Loading…
Add table
Reference in a new issue