From 5c23accd9e09ce5e56f9476e518e59a41210177d Mon Sep 17 00:00:00 2001 From: Pan Date: Fri, 9 Nov 2018 13:37:23 +0800 Subject: [PATCH] fix[Breadcurmb]: fixed pathCompile bug --- src/components/Breadcrumb/index.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 32a8fb69..70ecbf1b 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -3,7 +3,7 @@ {{ generateTitle(item.meta.title) }} - {{ generateTitle(item.meta.title) }} + {{ generateTitle(item.meta.title) }} @@ -30,12 +30,8 @@ export default { methods: { generateTitle, getBreadcrumb() { - const { params } = this.$route let matched = this.$route.matched.filter(item => { if (item.name) { - // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 - var toPath = pathToRegexp.compile(item.path) - item.path = toPath(params) return true } }) @@ -44,6 +40,12 @@ export default { matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched) } this.levelList = matched + }, + pathCompile(path) { + // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 + const { params } = this.$route + var toPath = pathToRegexp.compile(path) + return toPath(params) } } }