do permission control, and it is possible to select and display the tree table and set checked=true, according to the permissions sent back by the background. If you change the permission setting, the checked=false, will fail, and the checked will still be true
. < hr >this.permissionTree[0].children.forEach((item, index) => {
if (item.children.length>=0) {
let childrenArr = [];
childrenArr = item.children.filter(child => {
if (child.permission !== undefined) {
if (role.permissions.indexOf(child.permission) >= 0) {
child.checked = true;
}else{
child.checked = false;
};
return child;
} else {
return child;
}
});
if(childrenArr.length>0){
item.children=childrenArr;
permissionTreeList.push(item);
}
console.info("childrenArr",childrenArr)
}
});