The format of the object obtained (there are many attributes in an object)
![](https://images2018.cnblogs.com/blog/1160762/201804/1160762-20180424190637593-1671483127.png)
The data format you want to convert to (an array with multiple objects, each object has an id and name properties)
![](https://images2018.cnblogs.com/blog/1160762/201804/1160762-20180424190504142-2005029396.png)
how to deal with
selectionChange(val) { // 列表选择
var dynamicTags1 = [];
var arr=[]
for(var i= 0;i<val.length;i++){
console.log(val[i])
var item = {};//定义一个空对象
arr.push(val[i].id);
item['id'] = val[i].id;//给对象添加id属性并赋值
item['name'] = val[i].name;//给对象添加name属性并赋值
dynamicTags1.push(item);//再将循环遍历得到的对象追加到数组
this.dynamicTags=dynamicTags1;
console.log(this.dynamicTags)
}
this.leader_id=arr.toString();
},