VUE面包屑组件

 1 <template>
 2     <el-breadcrumb separator-class="el-icon-arrow-right">
 3         <el-breadcrumb-item v-for="item in breadList"
 4                             :to="{path:item.path}"
 5                             :key="item.name">{{item.meta.title}}</el-breadcrumb-item>
 6     </el-breadcrumb>
 7 </template>
 8 
 9 <script>
10 export default {
11     created () {
12         this.getBreadcrumb()
13     },
14     data () {
15         return {
16             breadList: []
17         }
18     },
19     watch: {
20         $route () {
21             this.getBreadcrumb()
22         }
23     },
24     methods: {
25         getBreadcrumb () {
26             let matched = this.$route.matched.filter(item => item.name)
27             this.breadList = matched
28         }
29     }
30 }
31 </script>

注册breadcrumb组件,并使用

 

路由配置如下:

 

 

转载于:https://www.cnblogs.com/nianyifenzhizuo/p/10316735.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值