1. 程式人生 > >陣列中的物件里加鍵值對

陣列中的物件里加鍵值對

let backTabledata = [
{
id:'126652',
no: '1',
longitude: '103.94292',
latitude: '30.620123',
altitude: 501.00143,
distance:'--'
}, {
id:'122855',
no: '2',
longitude: '103.94292',
latitude: '30.620123',
altitude: 501.00143,
distance:'258.25'
}, {
id:'1285569',
no: '3',
longitude: '103.94292',
latitude: '30.620123',
altitude: 501.00143,
distance:'253'
}, {
id:'1222555',
no: '4',
longitude: '103.94292',
latitude: '30.620123',
altitude: 501.00143,
distance:'253'
}];
for(let i in backTabledata){
//console.log(data[i]);
backTabledata[i].longitudeflag = false;
backTabledata[i].latitudeflag = false;
backTabledata[i].altitudeflag = false;
}
this.tableData = backTabledata;