// 处理商品类目数据问题
export const formatRes = function (res) {
  const arr = []
  let obj = {}
  res.forEach(item => {
    const tmp = { ...item }
    // console.log('tmp',item)
    if (item.name) {
      // console.log('tmp',tmp)
      if (tmp.childList) {
        tmp.children = formatRes(tmp.childList)
        // console.log('tmp', tmp)
        obj = {
          title: tmp.name,
          children: tmp.children,
          categoryId: tmp.categoryId,
          level: tmp.level,
          clazzId: tmp.clazzId,
          thumb: tmp.thumb,
          updateTime: tmp.updateTime
        }
      }
      arr.push(obj)
    }
  })
  // console.log('arr',arr);
  // this.data5 = arr
  return arr
}
