根据现有的树形结构生成新的树形结构
test: [
{
id: 1,
domain: '一级域1',
isSelect: true,
children: [
{
id: 11,
domain: '二级域11',
parentid: 1,
isSelect: true,
children: [
{
id: 111,
domain: '三级域1121',
parentid: 11,
isSelect: true,
children: [
{
id: 1111,
isSelect: true,
parentid: 111,
domain: '四级域111',
},
],
},
{
id: 111,
domain: '三级域1311',
parentid: 11,
isSelect: true,
children: [
{
id: 1111,
isSelect: true,
parentid: 111,
domain: '四级域111',
},
],
},
{
id: 111,
domain: '三级域1411',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1511',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1611',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1711',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1811',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1911',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域1110',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
{
id: 111,
domain: '三级域11111',
parentid: 11,
children: [{ id: 1111, parentid: 111, domain: '四级域111' }],
},
],
},
{
id: 12,
domain: '二级域12',
isSelect: true,
children: [
{
id: 112,
domain: '三级域112',
parentid: 12,
isSelect: true,
children: [{ id: 1111, parentid: 112, domain: '四级域1111' }],
},
],
},
],
},
{
id: 2,
domain: '一级域2',
isSelect: true,
children: [
{
id: 21,
domain: '二级域21',
parentid: 2,
isSelect: true,
children: [{ id: 211, isSelect: true, parentid: 21, domain: '三级域211' }],
},
{
id: 22,
domain: '二级域22',
parentid: 2,
children: [{ id: 212, parentid: 21, domain: '三级域212' }],
},
],
},
{
id: 3,
domain: '一级域3',
children: [
{
id: 31,
domain: '二级域31',
parentid: 3,
children: [{ id: 311, parentid: 31, domain: '三级域311' }],
},
{
id: 32,
domain: '二级域32',
parentid: 3,
children: [{ id: 312, parentid: 31, domain: '三级域312' }],
},
],
},
{
id: 4,
domain: '一级域4',
children: [
{
id: 41,
parentid: 4,
domain: '二级域41',
},
{
id: 42,
parentid: 4,
domain: '二级域42',
},
],
},
{
id: 5,
domain: '一级域5',
},
],
stepList: [
{
title: 'a',
subTitle: '1',
},
{
title: 'b',
subTitle: '2',
},
{
title: 'c',
subTitle: '3',
},
]
根据有isSelect: true的字段生成新的树形结构,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下这个是你想要的效果吗