diff --git a/src/components/Breadcrumb/index.vue b/src/components/Breadcrumb/index.vue index 6ca6291..2d684f0 100644 --- a/src/components/Breadcrumb/index.vue +++ b/src/components/Breadcrumb/index.vue @@ -3,7 +3,7 @@ {{ item.meta.title }} - {{ item.meta.title }} + {{ item.meta.title }} @@ -28,12 +28,8 @@ export default { }, methods: { 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 } }) @@ -42,6 +38,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) } } }