1 回答
TA贡献1854条经验 获得超8个赞
var contents = what.contents, //先获取数据
tempArr = [];
for( var i = 0,content; content = contents[i++]; ){
var arr = [];
for( var key in content ){
var obj_1 = {},
obj_2 = {};
if(key == "Plan_ADEP"){
obj_1[key] = content[key];
arr.push(obj_1);
}
if(key == "Plan_ADES"){
obj_2[key] = content[key];
arr.push(obj_2);
}
}
tempArr.push(arr);
//tempArr就是你要的值
}
//或者这样写更简单:
/*
for( var i = 0,content; content = contents[i++]; ){
var arr = [],obj_1 = {},obj_2 = {};
obj_1.Plan_ADEP = content.Plan_ADEP;
obj_2.Plan_ADES = content.Plan_ADES;
arr.push(obj_1);
arr.push(obj_2);
tempArr.push(arr);
//tempArr就是你要的值
}
*/
不知道我有没有理解错你的意思
添加回答
举报