addKey(dataSource) {
return dataSource.map(c => {
if (c.children) {
return this.addKey(c.children);//return 之后就不会执行以下的操作了
}
let key = c.children ? c.catalogId : c.governId;
return ({ ...c, key: key })
})
}
addKey(dataSource) {
return dataSource.map(c => {
if (c.children) {
return this.addKey(c.children);//return 之后就不会执行以下的操作了
}
let key = c.children ? c.catalogId : c.governId;
return ({ ...c, key: key })
})
}