遍历,没有就创建新的对象,有的就push进去

2017-10-24  本文已影响0人  qqqc
let lineData = []
    var obj = {}
    var dateList = []
    var legendName = []
    $.each(pileData.data.table, function (index, item) {
      dateList.push(item.dayId)
      $.each(item.children, function (index2, item2) {
        if (obj[item2.name] === undefined) {
          obj[item2.name] = {}
          obj[item2.name].name = item2.name
          obj[item2.name].data = []
        }
        obj[item2.name].data.push(item2.ip)
      })
    })
上一篇下一篇

猜你喜欢

热点阅读