遍历树形结构记录

例如:

遍历树形结构记录_第1张图片

遍历树形结构记录_第2张图片

这是递归对树形结构的遍历

findMatchingValue(json1,json2){

        if(json1.defaultLabel&&json2.some(item=>item.title==json1.defaultLabel)){

                //将匹配的值保存起来

                this.matchedValue.push(json1.defaultLabel)

        }

        if(json1.childrens&&json1.childrens.length>0){

                json1.childrens.forEach(child=>{  

                         this.findMatchingValue(child,json2)  

                })

        }        

}

你可能感兴趣的:(java,前端,服务器)