feat 面包屑有重复选项 隐藏
This commit is contained in:
parent
b908832ded
commit
95da221144
@ -1,18 +1,18 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-breadcrumb separator-class="el-icon-caret-right" class="app-breadcrumb">
|
<el-breadcrumb separator-class="el-icon-caret-right" class="app-breadcrumb">
|
||||||
<el-breadcrumb-item>
|
<el-breadcrumb-item>
|
||||||
<!-- <router-link to="/">飞机主控</router-link> -->
|
|
||||||
{{ $route.meta.tapName === "plane" ? "飞机主控" : "小程序后台" }}
|
{{ $route.meta.tapName === "plane" ? "飞机主控" : "小程序后台" }}
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
<el-breadcrumb-item v-for="(item, index) in breadcrumb" :key="index">
|
<el-breadcrumb-item
|
||||||
<!-- <router-link :to="item.path">{{ item.title }}</router-link> -->
|
v-for="(item, index) in filteredBreadcrumb"
|
||||||
|
:key="index"
|
||||||
|
>
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</el-breadcrumb-item>
|
</el-breadcrumb-item>
|
||||||
</el-breadcrumb>
|
</el-breadcrumb>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Breadcrumb',
|
name: 'Breadcrumb',
|
||||||
data () {
|
data () {
|
||||||
@ -29,7 +29,9 @@ export default {
|
|||||||
*/
|
*/
|
||||||
routes () {
|
routes () {
|
||||||
return this.$router.options.routes.filter(
|
return this.$router.options.routes.filter(
|
||||||
item => item.meta.hidden !== true && item.meta.roles.indexOf(this.$store.state.user.power.trim()) >= 0
|
item =>
|
||||||
|
item.meta.hidden !== true &&
|
||||||
|
item.meta.roles.indexOf(this.$store.state.user.power.trim()) >= 0
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@ -37,6 +39,16 @@ export default {
|
|||||||
*/
|
*/
|
||||||
presentPath () {
|
presentPath () {
|
||||||
return this.$route.path
|
return this.$route.path
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* @description: 过滤重复的面包屑
|
||||||
|
*/
|
||||||
|
filteredBreadcrumb () {
|
||||||
|
const list = this.breadcrumb
|
||||||
|
if (list.length <= 1) return list
|
||||||
|
const last = list[list.length - 1]
|
||||||
|
const isDuplicate = list.slice(0, -1).some(item => item.title === last.title)
|
||||||
|
return isDuplicate ? [last] : list
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -79,7 +91,6 @@ export default {
|
|||||||
display: block !important;
|
display: block !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 当屏幕宽度小于等于480px时 */
|
|
||||||
@media (max-width: 480px) {
|
@media (max-width: 480px) {
|
||||||
.app-breadcrumb {
|
.app-breadcrumb {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
|
@ -628,6 +628,29 @@ const routes = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: '/download',
|
||||||
|
component: Layout,
|
||||||
|
redirect: '/download/index',
|
||||||
|
meta: {
|
||||||
|
title: '软件下载',
|
||||||
|
icon: 'el-icon-download',
|
||||||
|
roles: ['master', 'admin', 'editor'],
|
||||||
|
tapName: 'admin'
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
path: '/download/index',
|
||||||
|
component: () => import('@/views/layout/components/main/download/index'),
|
||||||
|
meta: {
|
||||||
|
title: '软件下载',
|
||||||
|
icon: 'el-icon-download',
|
||||||
|
roles: ['master', 'admin', 'editor'],
|
||||||
|
tapName: 'admin'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/404',
|
||||||
component: Page404,
|
component: Page404,
|
||||||
|
@ -13,7 +13,8 @@ const defaultModuleVisibilityMap = {
|
|||||||
category: true,
|
category: true,
|
||||||
broadcast: true,
|
broadcast: true,
|
||||||
order: true,
|
order: true,
|
||||||
nofly: true
|
nofly: true,
|
||||||
|
download: true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 从 localStorage 读取已有配置,合并覆盖默认配置
|
// 从 localStorage 读取已有配置,合并覆盖默认配置
|
||||||
|
@ -55,7 +55,8 @@ export default {
|
|||||||
{ value: 'planes', label: '作业管理' },
|
{ value: 'planes', label: '作业管理' },
|
||||||
{ value: 'shop', label: '单位管理' },
|
{ value: 'shop', label: '单位管理' },
|
||||||
{ value: 'admin', label: '账户管理' },
|
{ value: 'admin', label: '账户管理' },
|
||||||
{ value: 'message', label: '公告管理' }
|
{ value: 'message', label: '公告管理' },
|
||||||
|
{ value: 'download', label: '软件下载' }
|
||||||
],
|
],
|
||||||
selectedModules: []
|
selectedModules: []
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user