Scrum / vue-2-breadcrumbs

Vue breadcrumbs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Only create li element if breadcrumb returns a value

garethbradley opened this issue · comments

Hey,

I am writing a CRUD type app that has an Index, Show, New etc. pages. An excerpt from the routes looks like this:

{
                    component: LayoutPage,
                    path: '/services',
                    meta: {
                        breadcrumb() {
                            return (this.$route.name === 'services') ? '' : 'Services';
                        }
                    },
                    children: [
                        {
                            component: ServicesIndex,
                            name: 'services',
                            path: '/',
                            meta: {
                                breadcrumb: 'Services'
                            },
                        }, {
                            component: ServicesNew,
                            name: 'services-new',
                            path: 'new',
                            meta: {
                                breadcrumb: 'New'
                            }
                        }

If I don't put that logic into breadcrumb function of the /services parent, it will always show the breadcrumb li as a link (presumably because it matches the. 'services' route.

But now it creates the Breadcrumb Home / / Services. (Home is defined further up the routes)

Can the library be updated to exclude blank breadcrumb functions?

Cheers!

@garethbradley Hi, thank you for your #92, see my comment