Skip to content

Commit 55dafab

Browse files
committed
fix: 面包屑:1.修复使用动态路由的时候,无法显示的bug
1 parent b56a5e0 commit 55dafab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/layout/components/Breadcrumb/src/Breadcrumb.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default defineComponent({
3737
})
3838
3939
const getBreadcrumb = () => {
40-
const currentPath = currentRoute.value.path
40+
const currentPath = currentRoute.value.matched.slice(-1)[0].path
4141
4242
levelList.value = filter<AppRouteRecordRaw>(unref(menuRouters), (node: AppRouteRecordRaw) => {
4343
return node.path === currentPath
@@ -47,7 +47,7 @@ export default defineComponent({
4747
const renderBreadcrumb = () => {
4848
const breadcrumbList = treeToList<AppRouteRecordRaw[]>(unref(levelList))
4949
return breadcrumbList.map((v) => {
50-
const disabled = v.redirect === 'noredirect'
50+
const disabled = !v.redirect || v.redirect === 'noredirect'
5151
const meta = v.meta as RouteMeta
5252
return (
5353
<ElBreadcrumbItem to={{ path: disabled ? '' : v.path }} key={v.name}>

0 commit comments

Comments
 (0)