美文网首页
后台返回的数据不是前端想要的

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

作者: 大筒木周助 | 来源:发表于2021-03-15 11:36 被阅读0次
    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];
                }
              }
            }
    

    相关文章

      网友评论

          本文标题:后台返回的数据不是前端想要的

          本文链接:https://www.haomeiwen.com/subject/oiqkcltx.html