|
@@ -3,7 +3,7 @@
|
3
|
3
|
<transition-group name="breadcrumb">
|
4
|
4
|
<el-breadcrumb-item v-for="(item,index) in levelList" v-if="item.meta.title" :key="item.path">
|
5
|
5
|
<span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
|
6
|
|
- <router-link v-else :to="item.redirect||item.path">{{ item.meta.title }}</router-link>
|
|
6
|
+ <router-link v-else :to="item.redirect||pathCompile(item.path)">{{ item.meta.title }}</router-link>
|
7
|
7
|
</el-breadcrumb-item>
|
8
|
8
|
</transition-group>
|
9
|
9
|
</el-breadcrumb>
|
|
@@ -28,12 +28,8 @@ export default {
|
28
|
28
|
},
|
29
|
29
|
methods: {
|
30
|
30
|
getBreadcrumb() {
|
31
|
|
- const { params } = this.$route
|
32
|
31
|
let matched = this.$route.matched.filter(item => {
|
33
|
32
|
if (item.name) {
|
34
|
|
- // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
|
35
|
|
- var toPath = pathToRegexp.compile(item.path)
|
36
|
|
- item.path = toPath(params)
|
37
|
33
|
return true
|
38
|
34
|
}
|
39
|
35
|
})
|
|
@@ -42,6 +38,12 @@ export default {
|
42
|
38
|
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
|
43
|
39
|
}
|
44
|
40
|
this.levelList = matched
|
|
41
|
+ },
|
|
42
|
+ pathCompile(path) {
|
|
43
|
+ // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
|
|
44
|
+ const { params } = this.$route
|
|
45
|
+ var toPath = pathToRegexp.compile(path)
|
|
46
|
+ return toPath(params)
|
45
|
47
|
}
|
46
|
48
|
}
|
47
|
49
|
}
|