代码:
/** * 树结构数据条件过滤 * 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 }
.
代码:
/** * 树结构数据条件过滤 * 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 }
.