From d3021bb0e45fd04fdcde3939219d116e6f76207c Mon Sep 17 00:00:00 2001 From: Bradley Date: Fri, 12 Jun 2020 12:45:30 +0100 Subject: [PATCH] Added test to exclude blank breadcrumbs --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index e8046f8..0644feb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -76,7 +76,8 @@ class VueBreadcrumbs implements PluginObject> { }, this.$breadcrumbs.map((crumb: RouteRecord, index: number) => { if (crumb?.meta?.breadcrumb) { - if (this.getBreadcrumb(crumb.meta.breadcrumb) === '') { + let label = this.getBreadcrumb(crumb.meta.breadcrumb); + if (label === '') { console.log('Breadcrumb blank. Ignoring'); } else { console.log('Breadcrumb valid', crumb?.meta?.breadcrumb); @@ -99,7 +100,7 @@ class VueBreadcrumbs implements PluginObject> { tag: index !== this.$breadcrumbs.length - 1 ? 'a' : 'span' } }, - ` ${this.getBreadcrumb(crumb.meta.breadcrumb)}` + ` ${label}` ) ] )