//需要格式
[{
"id":1,
"name":"name1"
},
{
"id":2,
"name":"name2"
}]
//members格式
[
{
"deptname": "deptname1",
"users": [
{
"id": 1,
"name": "name1"
},
{
"id": 2,
"name": "name2"
}
]
},
{
"deptname": "deptname2",
"users": [
{
"id": 1,
"name": "name1"
},
{
"id": 2,
"name": "name2"
}
]
}
]
this.members.map((item,index)=>{
for(useritem in item.users){
this.leaders.push(
Object.assign(item.users[useritem])
)
}
});