File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
src/components/Breadcrumb Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 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" >{{ generateTitle(item.meta.title) }}</span >
6
- <router-link v-else :to =" item.redirect||item.path" >{{ generateTitle(item.meta.title) }}</router-link >
6
+ <router-link v-else :to =" item.redirect||pathCompile( item.path) " >{{ generateTitle(item.meta.title) }}</router-link >
7
7
</el-breadcrumb-item >
8
8
</transition-group >
9
9
</el-breadcrumb >
@@ -30,12 +30,8 @@ export default {
30
30
methods: {
31
31
generateTitle,
32
32
getBreadcrumb () {
33
- const { params } = this .$route
34
33
let matched = this .$route .matched .filter (item => {
35
34
if (item .name ) {
36
- // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
37
- var toPath = pathToRegexp .compile (item .path )
38
- item .path = toPath (params)
39
35
return true
40
36
}
41
37
})
@@ -44,6 +40,12 @@ export default {
44
40
matched = [{ path: ' /dashboard' , meta: { title: ' dashboard' }}].concat (matched)
45
41
}
46
42
this .levelList = matched
43
+ },
44
+ pathCompile (path ) {
45
+ // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
46
+ const { params } = this .$route
47
+ var toPath = pathToRegexp .compile (path)
48
+ return toPath (params)
47
49
}
48
50
}
49
51
}
You can’t perform that action at this time.
0 commit comments