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組件,並使用

 

路由配置如下:

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM