Skip to content

Commit d4f8668

Browse files
committed
fix[Breadcrumb]: fixed eslint error
1 parent abfb862 commit d4f8668

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/components/Breadcrumb/index.vue

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<el-breadcrumb class="app-breadcrumb" separator="/">
33
<transition-group name="breadcrumb">
4-
<el-breadcrumb-item v-for="(item,index) in levelList" v-if="item.meta.title&&item.meta.breadcrumb!==false" :key="item.path">
4+
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
55
<span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
66
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
77
</el-breadcrumb-item>
@@ -28,16 +28,14 @@ export default {
2828
},
2929
methods: {
3030
getBreadcrumb() {
31-
let matched = this.$route.matched.filter(item => {
32-
if (item.name) {
33-
return true
34-
}
35-
})
31+
let matched = this.$route.matched.filter(item => item.name)
32+
3633
const first = matched[0]
3734
if (first && first.name !== 'dashboard') {
3835
matched = [{ path: '/dashboard', meta: { title: 'Dashboard' }}].concat(matched)
3936
}
40-
this.levelList = matched
37+
38+
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
4139
},
4240
pathCompile(path) {
4341
// To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561

0 commit comments

Comments
 (0)