File tree 1 file changed +1
-3
lines changed
src/runtime/nuxt/composables
1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change @@ -113,8 +113,6 @@ function titleCase(s: string) {
113
113
114
114
export function useBreadcrumbItems ( options : BreadcrumbProps = { } ) {
115
115
const router = useRouter ( )
116
- const routes = router . getRoutes ( )
117
-
118
116
const i18n = useI18n ( )
119
117
const siteResolver = createSitePathResolver ( {
120
118
canonical : true ,
@@ -149,7 +147,7 @@ export function useBreadcrumbItems(options: BreadcrumbProps = {}) {
149
147
segments . push ( ...options . append )
150
148
return ( segments . filter ( Boolean ) as BreadcrumbItemProps [ ] )
151
149
. map ( ( item ) => {
152
- const route = router . resolve ( item . to ) ?. matched
150
+ const route = router . resolve ( item . to ) ?. matched ?. [ 0 ] || router . currentRoute . value // fallback to current route
153
151
const routeMeta = ( route ?. meta || { } ) as RouteMeta & { title ?: string , breadcrumbLabel : string }
154
152
const routeName = route ? String ( route . name || route . path ) : ( item . to === '/' ? 'index' : 'unknown' )
155
153
let [ name ] = routeName . split ( '___' )
You can’t perform that action at this time.
0 commit comments