for in

var data={002:长治}遍历为json 对象 
    

var data=[
    {name:长治,code:002},
]

var arr = {002:'长治'};

1

for(var i in arr) {

  console.log('索引:' + i + ',值:' + arr[i]);}

2  

Object.keys(res.data.list).map(id => {

  let bankList = {

    code: id,

    text: res.data.list[id]

  };

  this.columns.push(bankList)

});

你可能感兴趣的:(for in)