js一个树形结构,怎么遍历它增加需要的属性
[{
"children": [{
"children": [{
"children": [{
"hasChildren": false,
"name": "小苔便利店",
"pid": 587,
"id": 1428553074498211840,
"label": "小苔便利店",
"deptType": 2,
"leaf": true
}],
"hasChildren": true,
"name": "天桥区",
"pid": 586,
"id": 587,
"label": "天桥区",
"deptType": 1,
"leaf": false
}, {
"hasChildren": false,
"name": "市中区",
"pid": 586,
"id": 588,
"label": "市中区",
"deptType": 1,
"leaf": true
}],
"hasChildren": true,
"name": "济南市",
"pid": 585,
"id": 586,
"label": "济南市",
"deptType": 1,
"leaf": false
}, {
"children": [{
"hasChildren": false,
"name": "111",
"pid": 589,
"id": 596,
"label": "111",
"deptType": 1,
"leaf": true
}],
"hasChildren": true,
"name": "青岛公司",
"pid": 585,
"id": 589,
"label": "青岛公司",
"deptType": 1,
"leaf": false
}],
"hasChildren": true,
"name": "中石油省公司",
"pid": null,
"id": 585,
"label": "中石油省公司",
"deptType": 1,
"leaf": false
}]
这种结构的数据,如果hasChildren: true
就给这一级增加isDisabled: true
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
数据