数据结构:
[
{
id: 0,
name: '父亲',
children: [
{
id: 1,
name: '儿子',
children: [
{
id: 2,
name: '孙子',
children: [.....]
}
]
}
......
]
}
......
]
代码:
handleData(data) {
for (let i in data) {
if (data[i].children) {
this.selete(data[i].children)
}
this.optionList.push(data[i])
}
}