This commit is contained in:
Taric Xin
2022-01-12 13:14:15 +08:00
parent ad33c512f1
commit 673b27a935
3 changed files with 21 additions and 7 deletions

View File

@ -105,10 +105,21 @@ export class MenuManagerComponentsIndexComponent implements OnInit {
deleteMenuByAppID(appId: string) {
this.service.request(this.service.$api_get_one, { appId }, 'POST', false).subscribe(res => {
console.log(res);
if (res) {
this.menus = res;
const menus = res.data;
console.log(this.getIds(res.data));
}
});
}
getIds(arr: Array<any>): Array<string> {
let ids: any[] = [];
arr.forEach(item => {
if (item.children?.length > 0) {
ids = [...ids, this.getIds(item.children)];
}
});
return ids;
}
}