forked from AkkomaGang/admin-fe
fix[Breadcrumb]: fixed eslint error (#1521)
This commit is contained in:
parent
77a40745bb
commit
f767fab4cc
1 changed files with 5 additions and 7 deletions
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-breadcrumb class="app-breadcrumb" separator="/">
|
<el-breadcrumb class="app-breadcrumb" separator="/">
|
||||||
<transition-group name="breadcrumb">
|
<transition-group name="breadcrumb">
|
||||||
<el-breadcrumb-item v-for="(item,index) in levelList" v-if="item.meta.title&&item.meta.breadcrumb!==false" :key="item.path">
|
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
|
||||||
<span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{
|
<span v-if="item.redirect==='noredirect'||index==levelList.length-1" class="no-redirect">{{
|
||||||
generateTitle(item.meta.title) }}</span>
|
generateTitle(item.meta.title) }}</span>
|
||||||
<a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
|
<a v-else @click.prevent="handleLink(item)">{{ generateTitle(item.meta.title) }}</a>
|
||||||
|
@ -31,16 +31,14 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
generateTitle,
|
generateTitle,
|
||||||
getBreadcrumb() {
|
getBreadcrumb() {
|
||||||
let matched = this.$route.matched.filter(item => {
|
let matched = this.$route.matched.filter(item => item.name)
|
||||||
if (item.name) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
})
|
|
||||||
const first = matched[0]
|
const first = matched[0]
|
||||||
if (first && first.name.trim().toLocaleLowerCase() !== 'Dashboard'.toLocaleLowerCase()) {
|
if (first && first.name.trim().toLocaleLowerCase() !== 'Dashboard'.toLocaleLowerCase()) {
|
||||||
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
|
matched = [{ path: '/dashboard', meta: { title: 'dashboard' }}].concat(matched)
|
||||||
}
|
}
|
||||||
this.levelList = matched
|
|
||||||
|
this.levelList = matched.filter(item => item.meta && item.meta.title && item.meta.breadcrumb !== false)
|
||||||
},
|
},
|
||||||
pathCompile(path) {
|
pathCompile(path) {
|
||||||
// To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
|
// To solve this problem https://github.com/PanJiaChen/vue-element-admin/issues/561
|
||||||
|
|
Loading…
Reference in a new issue