소스 검색

fix: 优化路由

wanggaokun 11 달 전
부모
커밋
9e45258fa3
1개의 변경된 파일2개의 추가작업 그리고 1개의 파일을 삭제
  1. 2 1
      src/utils/index.ts

+ 2 - 1
src/utils/index.ts

@@ -178,7 +178,8 @@ export function getMenuPath(menuList: Menu.MenuOptions[], path?: string) {
   let newMenuList: Menu.MenuOptions[] = JSON.parse(JSON.stringify(menuList))
   return newMenuList.map(item => {
     if (path) {
-      item.path = `${path}/${item.path}`
+      const newPath = path.replace(/none|\/none/g, '')
+      item.path = `${newPath}/${item.path}`
     }
     item.children?.length && (item.children = getMenuPath(item.children, item.path))
     return item