json过滤,改变数组格式

//需要格式
[{
"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])     
					    )
				}
			});
上一篇:type=file 文件修改表单 名称不能正常回显的问题


下一篇:柚子酱的Mysql学习笔记(一)