- 收敛管理端公共 Modal 链路,新增表单弹窗与普通内容弹窗包装\n- 迁移 Bot、知识库、插件、工作流、资源、MCP、数据中枢与系统管理页面级弹窗\n- 统一内容区工具栏、列表容器、导航与顶部按钮的视觉密度和交互节奏
75 lines
1.6 KiB
Vue
75 lines
1.6 KiB
Vue
<script lang="ts" setup>
|
|
import type { BreadcrumbStyleType } from '@easyflow/types';
|
|
|
|
import type { IBreadcrumb } from '@easyflow-core/shadcn-ui';
|
|
|
|
import { computed } from 'vue';
|
|
import { useRoute, useRouter } from 'vue-router';
|
|
|
|
import { $t } from '@easyflow/locales';
|
|
|
|
import { EasyFlowBreadcrumbView } from '@easyflow-core/shadcn-ui';
|
|
|
|
interface Props {
|
|
hideWhenOnlyOne?: boolean;
|
|
showHome?: boolean;
|
|
showIcon?: boolean;
|
|
type?: BreadcrumbStyleType;
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
showHome: false,
|
|
showIcon: false,
|
|
type: 'normal',
|
|
});
|
|
|
|
const route = useRoute();
|
|
const router = useRouter();
|
|
|
|
const breadcrumbs = computed((): IBreadcrumb[] => {
|
|
const matched = route.matched;
|
|
|
|
const resultBreadcrumb: IBreadcrumb[] = [];
|
|
|
|
for (const match of matched) {
|
|
const { meta, path } = match;
|
|
const { hideChildrenInMenu, hideInBreadcrumb, icon, name, title } =
|
|
meta || {};
|
|
if (hideInBreadcrumb || hideChildrenInMenu || !path) {
|
|
continue;
|
|
}
|
|
|
|
resultBreadcrumb.push({
|
|
icon,
|
|
path: path || route.path,
|
|
title: title ? $t((title || name) as string) : '',
|
|
});
|
|
}
|
|
if (props.showHome) {
|
|
resultBreadcrumb.unshift({
|
|
icon: 'mdi:home-outline',
|
|
isHome: true,
|
|
path: '/',
|
|
});
|
|
}
|
|
if (props.hideWhenOnlyOne && resultBreadcrumb.length === 1) {
|
|
return [];
|
|
}
|
|
|
|
return resultBreadcrumb.slice(-2);
|
|
});
|
|
|
|
function handleSelect(path: string) {
|
|
router.push(path);
|
|
}
|
|
</script>
|
|
<template>
|
|
<EasyFlowBreadcrumbView
|
|
:breadcrumbs="breadcrumbs"
|
|
:show-icon="showIcon"
|
|
:style-type="type"
|
|
class="min-w-0"
|
|
@select="handleSelect"
|
|
/>
|
|
</template>
|