Skip to content
Snippets Groups Projects
Unverified Commit d1cceb69 authored by 花裤衩's avatar 花裤衩 Committed by GitHub
Browse files

feature: add pathToRegexp to compile path (#1148)

parent ff13ee1f
Branches
Tags
No related merge requests found
......@@ -11,6 +11,7 @@
<script>
import { generateTitle } from '@/utils/i18n'
import pathToRegexp from 'path-to-regexp'
export default {
data() {
......@@ -29,7 +30,15 @@ export default {
methods: {
generateTitle,
getBreadcrumb() {
let matched = this.$route.matched.filter(item => item.name)
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
}
})
const first = matched[0]
if (first && first.name.trim().toLocaleLowerCase() !== 'Dashboard'.toLocaleLowerCase()) {
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment