1
0
mirror of https://github.com/zclzone/vue-naive-admin.git synced 2025-04-30 22:29:01 +08:00

fix: 面包屑过滤

This commit is contained in:
zclzone 2023-12-16 22:14:45 +08:00
parent 44d962c2ff
commit fc6df74d9e

View File

@ -12,13 +12,16 @@
{{ route.meta.title }}
</n-breadcrumb-item>
<n-breadcrumb-item
v-for="item of breadItems"
v-for="(item, index) of breadItems"
v-else
:key="item.code"
:clickable="!!item.path"
@click="handleItemClick(item)"
>
<n-dropdown :options="getDropOptions(item.children)" @select="handleDropSelect">
<n-dropdown
:options="index < breadItems.length - 1 ? getDropOptions(item.children) : []"
@select="handleDropSelect"
>
<div class="flex items-center">
<i :class="item.icon" class="mr-8" />
{{ item.name }}
@ -65,11 +68,13 @@ function handleItemClick(item) {
}
function getDropOptions(list = []) {
return list.map((child) => ({
label: child.name,
key: child.code,
icon: () => h('i', { class: child.icon }),
}))
return list
.filter((item) => item.show)
.map((child) => ({
label: child.name,
key: child.code,
icon: () => h('i', { class: child.icon }),
}))
}
function handleDropSelect(code) {