/*
通过$route来渲染面包屑
path: 当前路由的路径
name: 当前路由的名称
params: 返回一个对象,路由参数
query: 返回一个对象,路由查询参数
matched: 返回一个数组,前匹配的路径中所包含的所有片段所对应的配置参数对象。
*/
<el-breadcrumb separator="/">
/*
v-for循环$route.matched拿到所有相关路由
to 是路由跳转
*/
<el-breadcrumb-item v-for="(item,index) in $route.matched" :key="index" :to="item.name === 'layout'?'/index':item.path">{{item.name === 'layout'? '首页':item.meta.title}}</el-breadcrumb-item>
</el-breadcrumb>
10-22
6376
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-18
2016
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
11-04
2813
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)