数组一:
arr1 = [
{uid: 2},
{uid: 3},
{uid: 4}
]
数组二:
arr2 = [
{
text: '随便1',
children: [
{uid: 1},
{uid: 2}
]
},
{
text: '随便2',
children: [
{uid: 3},
{uid: 4}
]
},
{
text: '随便3',
children: [
{uid: 5},
{uid: 6}
]
}
]
想得到的效果
arr2 = [
{
text: '随便1',
children: [
{uid: 1, checked: false},
{uid: 2, checked: true}
]
},
{
text: '随便2',
children: [
{uid: 3, checked: true},
{uid: 4, checked: true}
]
},
{
text: '随便3',
children: [
{uid: 5, checked: false},
{uid: 6, checked: false}
]
}
]
数组arr1 中的uid的值对应在数组arr2 中添加属性 checked: true, 反之就是false。
请大神们帮我看看这个问题... 万分感谢。