function loop(data) { let office = data.map(item => { if (item.children) { if(item.type == ‘1‘ ||item.type == ‘2‘) { item = {...item,disabled:true,children:loop(item.children)} return item } } }) return office } let officeDataTree = loop(officeData)
时间: 2024-10-06 13:01:51