From 5f6d450bbee41e1a6dedeb14a33a0f8ee6c2df1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E4=BA=91=E6=B5=B7?= <414199639@qq.com> Date: Sun, 29 Sep 2019 20:03:39 +0800 Subject: [PATCH] =?UTF-8?q?fix[Dashboard]:=20=E9=A1=B5=E9=9D=A2=E7=AC=AC?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E5=8A=A0=E8=BD=BD=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E5=87=BD=E6=95=B0=E4=B8=BA=E4=BB=80=E4=B9=88=E4=BC=9A?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=B8=A4=E6=AC=A1=EF=BC=9F=20#2601?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Breadcrumb/index.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index e224ff73..3fc6d76e 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -33,14 +33,26 @@ export default { methods: { getBreadcrumb() { // only show routes with meta.title - let matched = this.$route.matched.filter(item => item.meta && item.meta.title) + let matched = [] + this.$route.matched.forEach(item => { + if (item.meta && item.meta.title && item.meta.breadcrumb !== false) { + matched.push({ + meta: { + title: item.meta.title + }, + path: item.path, + name: item.name + }) + } + }) + const first = matched[0] if (!this.isDashboard(first)) { matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched) } - this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) + this.levelList = matched }, isDashboard(route) { const name = route && route.name