
export default function fn(data, pid) {
  const result = []
  let temp
  for (let i = 0; i < data.length; i++) {
    if (data[i].pid === pid) {
      const obj = { 'path': data[i].path, 'component': () => import(`@/views${(data[i].component)}`), 'redirect': data[i].redirect, alwaysShow: true, 'name': data[i].name, meta: { 'title': data[i].title, 'icon': data[i].icon, 'keepAlive': true }}
      temp = fn(data, data[i].id)
      if (temp.length > 0) {
        obj.children = temp
      }
      result.push(obj)
    }
  }
  return result
}
