数据结构如下:
demo(res.data, [])
const demo = (val: any, arr: any[], num: any = 0) => {
val.map((item: any, index: any) => {
arr.push({
title: item.name,
key: item.id,
value: item.id,
children: [],
disabled: num != 2,
});
if (item && item.children) {
demo(item.children, arr[index].children, num + 1);
}
TreeListDevs.value = arr;
});
};