RuoYi
2025-03-01 93fe80dc685c47329bdb831e5c16236619d28425
优化前端处理路由函数代码
已修改1个文件
27 ■■■■ 文件已修改
src/store/modules/permission.js 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/store/modules/permission.js
@@ -85,28 +85,13 @@
function filterChildren(childrenMap, lastRouter = false) {
  var children = []
  childrenMap.forEach((el, index) => {
    if (el.children && el.children.length) {
      if (el.component === 'ParentView' && !lastRouter) {
        el.children.forEach(c => {
          c.path = el.path + '/' + c.path
          if (c.children && c.children.length) {
            children = children.concat(filterChildren(c.children, c))
            return
          }
          children.push(c)
        })
        return
      }
    }
    if (lastRouter) {
      el.path = lastRouter.path + '/' + el.path
      if (el.children && el.children.length) {
  childrenMap.forEach(el => {
    el.path = lastRouter ? lastRouter.path + '/' + el.path : el.path
    if (el.children && el.children.length && el.component === 'ParentView') {
        children = children.concat(filterChildren(el.children, el))
        return
    } else {
      children.push(el)
      }
    }
    children = children.concat(el)
  })
  return children
}
@@ -136,7 +121,7 @@
      res = () => modules[path]();
    }
  }
  return res;
  return res
}
export default usePermissionStore