diff --git a/src/breadcrumb/CBreadcrumbRouter.js b/src/breadcrumb/CBreadcrumbRouter.js index 500f1c06..6c618c60 100644 --- a/src/breadcrumb/CBreadcrumbRouter.js +++ b/src/breadcrumb/CBreadcrumbRouter.js @@ -16,12 +16,12 @@ const getPaths = pathname => { return paths } -const CBreadcrumbRouteItem = ({name, path}, currPath) => { - if (path === currPath) { - return {name} +const CBreadcrumbRouteItem = ({name, currPath}, fullCurrPath) => { + if (currPath === fullCurrPath) { + return {name} } else { - return - + return + {name} @@ -41,11 +41,12 @@ const CBreadcrumbRouter = props => { if (routes) { const currPath = useLocation().pathname const paths = getPaths(currPath) - const currRoutes = paths.map(path => { - return routes.find(route => matchPath(path, { + const currRoutes = paths.map(currPath => { + const route = routes.find(route => matchPath(currPath, { path: route.path, exact: route.exact })) + return { ...route, currPath } }).filter(route => route) items = currRoutes.map(route => { return CBreadcrumbRouteItem(route, currPath)