File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
src/components/Breadcrumb Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 94
94
"node-sass" : " ^4.7.2" ,
95
95
"optimize-css-assets-webpack-plugin" : " 5.0.0" ,
96
96
"ora" : " 3.0.0" ,
97
+ "path-to-regexp" : " 2.4.0" ,
97
98
"portfinder" : " 1.0.13" ,
98
99
"postcss-import" : " 11.1.0" ,
99
100
"postcss-loader" : " 2.1.6" ,
Original file line number Diff line number Diff line change 11
11
12
12
<script >
13
13
import { generateTitle } from ' @/utils/i18n'
14
+ import pathToRegexp from ' path-to-regexp'
14
15
15
16
export default {
16
17
data () {
@@ -29,7 +30,15 @@ export default {
29
30
methods: {
30
31
generateTitle,
31
32
getBreadcrumb () {
32
- let matched = this .$route .matched .filter (item => item .name )
33
+ const { params } = this .$route
34
+ let matched = this .$route .matched .filter (item => {
35
+ 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
+ return true
40
+ }
41
+ })
33
42
const first = matched[0 ]
34
43
if (first && first .name .trim ().toLocaleLowerCase () !== ' Dashboard' .toLocaleLowerCase ()) {
35
44
matched = [{ path: ' /dashboard' , meta: { title: ' dashboard' }}].concat (matched)
You can’t perform that action at this time.
0 commit comments