You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12 lines
353 B
JavaScript

export function getNodeByKeyAndCallbackProcess (data, targetkey, callback) {
data.forEach((item, index, arr) => {
if (item.key === targetkey) {
return callback(item, index, arr)
}
if (item.children) {
return getNodeByKeyAndCallbackProcess(item.children, targetkey, callback)
}
})
}