requirements as above, the data are as follows
data= [
{
id: 0,
event: "1",
timeLine: 50,
comment: "",
age:13
},
{
id: 1,
event: "1",
timeLine: 100,
comment: "",
age:13
children: [
{
id: 2,
event: "2",
timeLine: 10,
comment: "",
age:11
},
{
id: 3,
event: "3",
timeLine: 90,
comment: "",
age:13
children: [
{
id: 4,
event: "4",
timeLine: 5,
comment: "",
age:17
},
{
id: 5,
event: "5",
timeLine: 10,
comment: "",
age:13
},
{
id: 6,
event: "6",
timeLine: 75,
comment: "",
age:13
children: [
{
id: 7,
event: "7",
timeLine: 50,
comment: "",
age:13
children: [
{
id: 71,
event: "71",
timeLine: 25,
comment: "xx",
age:18
},
{
id: 72,
event: "72",
timeLine: 5,
comment: "xx",
age:13
},
{
id: 73,
event: "73",
timeLine: 20,
comment: "xx",
age:15
}
]
},
{
id: 8,
event: "8",
timeLine: 25,
comment: "",
age:19
}
]
}
]
}
]
}
]
now we want to filter data according to the attribute that age is 13, get a new tree structure, and find a recursive method
.