vue怎么遞歸遍歷數(shù)組?
function digui(val) {
let arr = [];
if (val.length !== 0) {
val.forEach(item => {
let obj = {};
obj.id = item.path;
obj.label = item.name;
if (item.children.length >= 1) {
obj.children = this.digui(item.children);
}
arr.push(obj);
});
}