根据id 11 删除指定节点,谢谢
[
{
id: '1',
name: 'a',
pid: '0',
children: [
{
id: '11',
name: 'a-1',
pid: '1',
children: [
{
id: '111',
name: 'a-1-1',
pid: '11',
children: null
}
]
}
]
},
{
id: '2',
name: 'b',
pid: '0',
children: null,
}
]
就遍历找就行了,记录父元素,找到了按索引删除就好了。