var date = [{
"align": "left",
"width": 170,
"fixed": true
}, {
"align": "left",
"width": 160,
"fixed": true
}, {
"align": "right",
"width": 110,
"fixed": true
}, {
"align": "right",
"width": 110,
"fixed": true
},{
"name": "09时",
"property": "h9",
"align": "right",
"width": 80,
"fixed": false
}
]
var data = {};
for(var i =0; i<24;i++){
if(i<10){
data.name = "0" + i + "时";
} else{
data.name = i + "时";
}
data.property = "h" + i;
data.align = "right";
data.width =80;
date.push(data);
}
console.log(date)
理想状态应该是打印24个小时。但是添加的都是循环的最后结果,是我有哪里搞错了吗?