后台返回的数据不是前端想要的

1618388590(1).jpg

var keyMap = {
id: "ID",
pcode: "PCode",
code: "Code",
name: "Name",
address_str: "Address",
p_type: "Ptype",
window_num: "WindowNum",
ground_num: "GroundNum",
machine_num: "MachineNum",
bus_num: "BusNum",
people_num: "PeopleNum",
img: "TrueImg",
lately_time: "LatelyTim",
is_sell: "Issell",
province: "Province",
city: "City",
longitude: "Longitude",
latitude: "Latitude",
origin: "Origin",
originnumber: "OriginNum",
height: "IsCollect",
online: "Online",
};

        for (var j = 0; j < list.length; j++) {
          var obj = list[j];
          for (var key in obj) {
            var newKey = keyMap[key];
            if (newKey) {
              obj[newKey] = obj[key];
              delete obj[key];
            }
          }
        }

你可能感兴趣的:(后台返回的数据不是前端想要的)