Merge pull request #1020 from iview/2.0

面包屑导航home页也可显示图标
This commit is contained in:
Lison 2018-10-10 18:38:01 +08:00 committed by GitHub
commit 7b89fca7fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -53,8 +53,9 @@ export const getMenuByRouter = (list, access) => {
* @returns {Array}
*/
export const getBreadCrumbList = (route, homeRoute) => {
let homeItem = { ...homeRoute, icon: homeRoute.meta.icon }
let routeMetched = route.matched
if (routeMetched.some(item => item.name === homeRoute.name)) return [homeRoute]
if (routeMetched.some(item => item.name === homeRoute.name)) return [homeItem]
let res = routeMetched.filter(item => {
return item.meta === undefined || !item.meta.hide
}).map(item => {
@ -70,7 +71,7 @@ export const getBreadCrumbList = (route, homeRoute) => {
res = res.filter(item => {
return !item.meta.hideInMenu
})
return [Object.assign(homeRoute, { to: homeRoute.path }), ...res]
return [{...homeItem, to: homeRoute.path}, ...res]
}
export const getRouteTitleHandled = route => {