hideInMenu: true 的面包屑不会显示
{
path: '/testBread/advanced-profile',
name: 'advanced-profile',
hideInMenu: true,
component: './TestBread/AdvancedProfile'
},
如果hideInMenu: true要显示面包屑, 进行下面的更改
// const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(menuData);//面包屑过滤掉hideInMenu: true,遇到这个菜单不显示当前它的面包屑
const breadcrumbNameMap = memoizeOneGetBreadcrumbNameMap(memoizeOneFormatter(routes, authority));//面包屑过滤掉hideInMenu: true,遇到这个菜单不显示当前它的面包屑
在不隐藏菜单、’同时该菜单也有component、并且它也不是最终子菜单时,希望该面包屑显示成普通span标签,不显示成默认的a跳转标签。可以给该路由添加一个属性:noShowLinkBread,然后再到breadcrumb.js找到生成面包屑的相关代码conversionFromLocation这个函数进行修改即可。
{
path: '/testBread',
name: 'testBread',
icon: 'profile',
authority: ['admin'],
component: './TestBread',
noShowLinkBread: true,//面包屑中显示时就不会因为有component就必须是可点击的了, 看src\components\PageHeader\breadcrumb.js的93行
routes: [
{
path: '/testBread/basic-profile',
name: 'basic-profile',
component: './TestBread/BasicProfile'
}
]
},
const isLinkable = index !== pathSnippets.length - 1 && currentBreadcrumb.component && !currentBreadcrumb.noShowLinkBread;