File tree 1 file changed +8
-7
lines changed 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,12 @@ const getPaths = pathname => {
16
16
return paths
17
17
}
18
18
19
- const CBreadcrumbRouteItem = ( { name, path } , currPath ) => {
20
- if ( path === currPath ) {
21
- return < CBreadcrumbItem key = { path } active > { name } </ CBreadcrumbItem >
19
+ const CBreadcrumbRouteItem = ( { name, currPath } , fullCurrPath ) => {
20
+ if ( currPath === fullCurrPath ) {
21
+ return < CBreadcrumbItem key = { currPath } active > { name } </ CBreadcrumbItem >
22
22
} else {
23
- return < CBreadcrumbItem key = { path } >
24
- < Link to = { path } >
23
+ return < CBreadcrumbItem key = { currPath } >
24
+ < Link to = { currPath } >
25
25
{ name }
26
26
</ Link >
27
27
</ CBreadcrumbItem >
@@ -41,11 +41,12 @@ const CBreadcrumbRouter = props => {
41
41
if ( routes ) {
42
42
const currPath = useLocation ( ) . pathname
43
43
const paths = getPaths ( currPath )
44
- const currRoutes = paths . map ( path => {
45
- return routes . find ( route => matchPath ( path , {
44
+ const currRoutes = paths . map ( currPath => {
45
+ const route = routes . find ( route => matchPath ( currPath , {
46
46
path : route . path ,
47
47
exact : route . exact
48
48
} ) )
49
+ return { ...route , currPath }
49
50
} ) . filter ( route => route )
50
51
items = currRoutes . map ( route => {
51
52
return CBreadcrumbRouteItem ( route , currPath )
You can’t perform that action at this time.
0 commit comments