perf[Breadcrumb]: refine getBreadcrumb function
This commit is contained in:
		| @@ -31,16 +31,23 @@ export default { | ||||
|   methods: { | ||||
|     generateTitle, | ||||
|     getBreadcrumb() { | ||||
|       // only show routes with name | ||||
|       let matched = this.$route.matched.filter(item => item.name) | ||||
|  | ||||
|       // only show routes with meta.title | ||||
|       let matched = this.$route.matched.filter(item => item.meta && item.meta.title) | ||||
|       const first = matched[0] | ||||
|       if (first && first.name.trim().toLocaleLowerCase() !== 'Dashboard'.toLocaleLowerCase()) { | ||||
|  | ||||
|       if (!this.isDashboard(first)) { | ||||
|         matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched) | ||||
|       } | ||||
|  | ||||
|       this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false) | ||||
|     }, | ||||
|     isDashboard(route) { | ||||
|       const name = route && route.name | ||||
|       if (!name) { | ||||
|         return false | ||||
|       } | ||||
|       return name.trim().toLocaleLowerCase() === 'Dashboard'.toLocaleLowerCase() | ||||
|     }, | ||||
|     pathCompile(path) { | ||||
|       // To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561 | ||||
|       const { params } = this.$route | ||||
|   | ||||
		Reference in New Issue
	
	Block a user