File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed
Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import type {
66 IUserNavItems ,
77 IUserNavMode ,
88} from './types' ;
9+ import { getLocaleClearPath } from './useSidebarData' ;
910import {
1011 getLocaleNav ,
1112 pickRouteSortMeta ,
@@ -64,7 +65,10 @@ export const useNavData = () => {
6465 . sort ( ( [ a ] , [ b ] ) => a . split ( '/' ) . length - b . split ( '/' ) . length )
6566 // convert sidebar data to nav data
6667 . reduce < Record < string , INavItems [ 0 ] > > ( ( ret , [ link , groups ] ) => {
67- const [ , parentPath , restPath ] = link . match ( / ^ ( \/ [ ^ / ] + ) ( [ ^ ] + ) ? $ / ) ! ;
68+ const [ , parentPath , restPath ] = `/${ getLocaleClearPath (
69+ link . replace ( / ^ \/ / , '' ) ,
70+ locale ,
71+ ) } `. match ( / ^ ( \/ [ ^ / ] + ) ( [ ^ ] + ) ? $ / ) ! ;
6872 const isNestedNav = Boolean ( restPath ) && is2LevelNav ;
6973 const [ firstMeta , secondMeta ] = Object . values ( routes ) . reduce <
7074 {
Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ import {
1515
1616const DEFAULT_GROUP_STUB_TITLE = '$default-group-title' ;
1717
18- const getLocaleClearPath = ( routePath : string , locale : ILocalesConfig [ 0 ] ) => {
18+ export const getLocaleClearPath = (
19+ routePath : string ,
20+ locale : ILocalesConfig [ 0 ] ,
21+ ) => {
1922 return 'base' in locale
2023 ? routePath . replace ( locale . base . slice ( 1 ) , '' ) . replace ( / ^ \/ / , '' )
2124 : routePath ;
You can’t perform that action at this time.
0 commit comments