途虎养车 - 前端 - 秋招 - 一面

  1. 项目经历,useRequest是怎么设计的
  2. 插件体系是怎么实现的
  3. Hooks和普通的函数之间的区别
  4. 防抖节流
  5. 实习经历,联动搜索框怎么复用
  6. setState,这个回去好好看看
  7. Vue3的Hook和React Hook的区别
  8. Vue3中怎么使用生命周期
  9. 同步和异步的概念
  10. JS异步任务有哪些
  11. 浏览器缓存
  12. interface和type的区别
  13. 手写题,计算菜单路径(面包屑)
function calculateBreadcrumbPath(menuList, currentPage) {
  let path = [];
  for (let item of menuList) {
    if (item.name === currentPage) {
      path.push(item.name);
      break;
    }
    if (item.children) {
      let subPath = calculateBreadcrumbPath(item.children, currentPage);
      if (subPath.length > 0) {
        path.push(item.name);
        path = path.concat(subPath);
        break;
      }
    }
  }
  return path;
}

let menuList = [
  {
    name: '管理',
    children: [
      {
        name: '列表',
        children: [
          { name: '用户详情' },
          { name: '权限列表' }
        ]
      }
    ]
  }
];
let currentPage = '用户详情';
console.log(calculateBreadcrumbPath(menuList, currentPage)); 
#软件开发笔面经#
全部评论
佬你什么时候面的
点赞 回复 分享
发布于 09-25 08:37 上海
佬,你这是偏向于react吗
点赞 回复 分享
发布于 09-25 15:11 江苏

相关推荐

4 1 评论
分享
牛客网
牛客企业服务