代码:
/**
* 树结构数据条件过滤
* js 指定删除数组(树结构数据)
*/
function filter (data, id) {
var newData = data.filter(x => x.id !== id)
newData.forEach(x => x.children && (x.children = filter(x.children, id)))
return newData
}
.
2023-02-02 08:01:13
代码:
/**
* 树结构数据条件过滤
* js 指定删除数组(树结构数据)
*/
function filter (data, id) {
var newData = data.filter(x => x.id !== id)
newData.forEach(x => x.children && (x.children = filter(x.children, id)))
return newData
}
.