14 lines
294 B
JavaScript
14 lines
294 B
JavaScript
export const matterTree = (array,data, id) => {
|
|
if (id) {
|
|
data.forEach(item => {
|
|
if (item.value == id) {
|
|
array.push(item.label);
|
|
}
|
|
if (item.children && item.children.length > 0) {
|
|
matterTree(array,item.children,id)
|
|
}
|
|
})
|
|
return array;
|
|
}
|
|
}
|