|
@@ -10,6 +10,8 @@
|
10
|
10
|
</template>
|
11
|
11
|
|
12
|
12
|
<script>
|
|
13
|
+import pathToRegexp from 'path-to-regexp'
|
|
14
|
+
|
13
|
15
|
export default {
|
14
|
16
|
data() {
|
15
|
17
|
return {
|
|
@@ -26,7 +28,15 @@ export default {
|
26
|
28
|
},
|
27
|
29
|
methods: {
|
28
|
30
|
getBreadcrumb() {
|
29
|
|
- let matched = this.$route.matched.filter(item => item.name)
|
|
31
|
+ const { params } = this.$route
|
|
32
|
+ let matched = this.$route.matched.filter(item => {
|
|
33
|
+ 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
|
+ return true
|
|
38
|
+ }
|
|
39
|
+ })
|
30
|
40
|
const first = matched[0]
|
31
|
41
|
if (first && first.name !== 'dashboard') {
|
32
|
42
|
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
|