perf:refine breadcrumb

This commit is contained in:
Pan 2017-11-24 15:35:38 +08:00
parent 061fa1f2a5
commit f876b9b678
2 changed files with 6 additions and 9 deletions

View File

@ -22,13 +22,9 @@ export default {
methods: { methods: {
getBreadcrumb() { getBreadcrumb() {
let matched = this.$route.matched.filter(item => item.name) let matched = this.$route.matched.filter(item => item.name)
if (matched.length === 0) {
this.levelList = [{ path: '/', meta: { title: '首页' }}]
return
}
const first = matched[0] const first = matched[0]
if (first && first.name !== 'dashboard') { if (first && first.name !== 'dashboard') {
matched = [{ path: '/', meta: { title: 'dashboard' }}].concat(matched) matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
} }
this.levelList = matched this.levelList = matched
}, },

View File

@ -87,6 +87,7 @@ export const asyncRouterMap = [
{ {
path: '/components', path: '/components',
component: Layout, component: Layout,
redirect: 'noredirect',
name: 'component-demo', name: 'component-demo',
meta: { meta: {
title: 'components', title: 'components',
@ -110,7 +111,7 @@ export const asyncRouterMap = [
{ {
path: '/charts', path: '/charts',
component: Layout, component: Layout,
redirect: '/charts/index', redirect: 'noredirect',
name: 'charts', name: 'charts',
meta: { meta: {
title: 'charts', title: 'charts',
@ -126,7 +127,7 @@ export const asyncRouterMap = [
{ {
path: '/example', path: '/example',
component: Layout, component: Layout,
redirect: 'noredirect', redirect: '/example/table/complex-table',
name: 'example', name: 'example',
meta: { meta: {
title: 'example', title: 'example',
@ -136,7 +137,7 @@ export const asyncRouterMap = [
{ {
path: '/example/table', path: '/example/table',
component: _import('example/table/index'), component: _import('example/table/index'),
redirect: '/example/table/table', redirect: '/example/table/complex-table',
name: 'Table', name: 'Table',
meta: { meta: {
title: 'Table', title: 'Table',
@ -193,7 +194,7 @@ export const asyncRouterMap = [
{ {
path: '/excel', path: '/excel',
component: Layout, component: Layout,
redirect: '/excel/download', redirect: '/excel/export-excel',
name: 'excel', name: 'excel',
meta: { meta: {
title: 'excel', title: 'excel',