作者:安小辰 | 来源:互联网 | 2023-10-12 10:32
vue+element UI 搭建的web项目,面包屑 首页>列表>内容
如何书写router.js
1 2 3 4 5 6 7 8
| {
path: '/index',
component: CdnLayout,
children: [
{ path: 'list', component: List, name: '列表页' },
{ path: 'list/detal', component: Detail, name: '内容'}
]
}, |
1 2 3 4 5 6 7
| let matched = this.$route.matched.filter(item => item.name;
);
const first = matched[0];
if (first && (first.name !== '首页' || first.path !== '')) {
matched = [{ name: '首页', path: '/index' }].concat(matched)
} |
那么我在这个面包屑中如何去写才可以在内容页面 可以显示 首页>列表>内容
谢谢,在线等