我有一个使用 angular-tree-component 的树状视图,并使用了以下链接Refernece
数组的格式如下:
nodes = [
{
id: 1,
name: 'root1',
children: [
{ id: 2, name: 'child1' },
{ id: 3, name: 'child2' }
]
},
{
id: 4,
name: 'root2',
children: [
{ id: 5, name: 'child2.1' },
{
id: 6,
name: 'child2.2',
children: [
{ id: 7, name: 'granchild 2.2.1' }
]
}
]
}
];
但是我有一个json
嵌套数组,格式如下:
[
{
"name": "root1",
"subCategory": [
{
"name": "child1",
"childCategory": []
},
{
"name": "child2",
"childCategory": []
}
]
},
{
"name": "level2",
"subCategory": [
{
"name": "level2.1",
"childCategory": []
},
{
"name": "level2.2",
"childCategory": [
{
"name": "granchild 2.2.1",
"type": "checkbox"
}
]
}
]
}
]
以下是我的疑问:
{"name": "granchild 2.2.1","type": "checkbox"}
。因此,孙子2.2.1应该是一个复选框,如果是单选按钮,则应该是单选。请指导我...