for循环递归

for循环递归


function afun(list){
list.forEach(i =>{
i.path = i.menuPath
if(i.childMenuList && i.childMenuList.length){
a(i.childMenuList)
}
})
console.log(list)
}
function bfun(){
var menuList= [{“id”:“8a89b4d678de07270178e91540060045”,“parentId”:“8a89b4d678de07270178dec3e75a0015”,“code”:“1618818187260”,“name”:“应急资源管理”,“menuPath”:"",“childMenuList”:[{“id”:“8a89b4d678de07270178e917ef0f0055”,“parentId”:“8a89b4d678de07270178e91540060045”,“code”:“1618818363151”,“name”:“应急物资管理”,“menuPath”:"",“childMenuList”:[{“id”:“8a89b4d678e9eb7d0178ee187cac0017”,“parentId”:“8a89b4d678de07270178e917ef0f0055”,“code”:“1618902285484”,“name”:“机构物资储备总览”,“menuPath”:“inventoryOverviewStaff”},{“id”:“8a89b4d678e9eb7d0178ee1845170010”,“parentId”:“8a89b4d678de07270178e917ef0f0055”,“code”:“1618902271255”,“name”:“全市物资储备管理”,“menuPath”:"/inventoryOverview"},{“id”:“8a89b4d678fc7bb10178fcbe5a09000d”,“parentId”:“8a89b4d678de07270178e917ef0f0055”,“code”:“1619148036617”,“name”:“储备库物资管理”,“menuPath”:"/inventoryManage"}]},{“id”:“8a89b4d678e9eb7d0178ee181d58000a”,“parentId”:“8a89b4d678de07270178e91540060045”,“code”:“1618902261079”,“name”:“资源目录管理”,“menuPath”:"",“childMenuList”:[{“id”:“8a89b4d678e9eb7d0178ee18b6aa001d”,“parentId”:“8a89b4d678e9eb7d0178ee181d58000a”,“code”:“1618902300330”,“name”:“全局资源”,“menuPath”:"/resourceList"},{“id”:“8a89b4d678e9eb7d0178ee196dd20033”,“parentId”:“8a89b4d678e9eb7d0178ee181d58000a”,“code”:“1618902347218”,“name”:“本地资源”,“menuPath”:"/resourceListLocal"}]}]}];

	afun(menuList)		
	
}

bfun()	
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值