发布时间:2026/8/29 13:12:18
Vue3面包屑(Breadcrumb) Vue2面包屑Breadcrumb可自定义设置以下属性router 的路由数组routes类型Array{name: string, path?: string, query?: { [propName: string]: any } }默认 []设置面包屑类名breadcrumbClass类型string默认 undefined设置面包屑样式breadcrumbStyle类型CSSProperties默认 {}设置文本最大显示宽度超出后显示省略号maxWidth类型string | number单位 px默认 100%自定义分隔符separator类型string | slot默认 undefined默认使用 分隔设置分隔符样式separatorStyle类型CSSProperties默认 {}如何打开目标URL当前窗口或新窗口target类型_self | _blank默认 _self效果如下图在线预览①创建面包屑组件Breadcrumb.vuescript setup langts import { computed } from vue import type { CSSProperties } from vue export interface Query { [propName: string]: any // 添加一个字符串索引签名用于包含带有任意数量的其他属性 } export interface Route { name: string // 路由名称 path?: string // 路由地址 query?: Query // 路由查询参数 } export interface Props { routes?: Route[] // router 路由数组 breadcrumbClass?: string // 设置面包屑类名 breadcrumbStyle?: CSSProperties // 设置面包屑样式 maxWidth?: string | number // 设置文本最大显示宽度超出后显示省略号单位 px separator?: string // 自定义分隔符默认为 string | slot separatorStyle?: CSSProperties // 设置分隔符样式 target?: _self | _blank // 如何打开目标 URL当前窗口或新窗口 } const props withDefaults(definePropsProps(), { routes: () [], breadcrumbClass: undefined, breadcrumbStyle: () ({}), maxWidth: 100%, separator: undefined, separatorStyle: () ({}), target: _self }) const breadcrumbAmount computed(() { return props.routes.length }) function getTargetUrl(route: Route): string { let targetUrl: string if (route.path) { targetUrl route.path } if (route.query JSON.stringify(route.query) ! {}) { const query route.query Object.keys(query).forEach((param, index) { if (index 0) { targetUrl targetUrl ? param query[param] } else { targetUrl targetUrl param query[param] } }) } return targetUrl } /script template div classbreadcrumb-wrap :classbreadcrumbClass :style[ --breadcrumb-color: rgba(0, 0, 0, 0.45); --breadcrumb-bg-color-hover: rgba(0, 0, 0, 0.06); --breadcrumb-color-hover: rgba(0, 0, 0, 0.88); --breadcrumb-color-active: rgba(0, 0, 0, 0.88); --breadcrumb-padding: 0 4px; --breadcrumb-border-radius: 4px; --breadcrumb-separator-color: rgba(0, 0, 0, 0.45); , breadcrumbStyle ] div classbreadcrumb-item v-for(route, index) in routes :keyindex component :isroute.path ? a : span classbreadcrumb-link :class{ link-hover: route.path, link-active: index breadcrumbAmount - 1 } :stylemax-width: ${maxWidth}px; :hrefgetTargetUrl(route) :targettarget :titleroute.name {{ route.name }} /component span v-ifindex breadcrumbAmount - 1 classbreadcrumb-separator :styleseparatorStyle slot nameseparator :routeroute :indexindex span v-ifseparator{{ separator }}/span svg v-else focusablefalse >script setup langts import Breadcrumb from ./Breadcrumb.vue import { ref } from vue import { ArrowRightOutlined, DoubleRightOutlined } from ant-design/icons-vue import type { BreadcrumbRoute } from vue-amazing-ui const routes refBreadcrumbRoute[]([ { name: 一级路由, path: /first }, { name: 二级路由, path: /second, query: { id: 1, tab: 2 } }, { name: 三级路由 } ]) const longNameRoutes refBreadcrumbRoute[]([ { name: 一级路由 }, { name: 二级路由, path: /second, query: { id: 1, tab: 2 } }, { name: 我是一个名字超长的三级路由 } ]) const customStyle { --breadcrumb-color: rgba(0, 0, 0, 0.65), --breadcrumb-bg-color-hover: rgba(0, 0, 0, 0.1), --breadcrumb-color-hover: #ff6900, --breadcrumb-color-active: #ff6900, --breadcrumb-padding: 4px 8px, --breadcrumb-border-radius: 8px, --breadcrumb-separator-color: rgba(0, 0, 0, 0.65) } /script template div h1{{ $route.name }} {{ $route.meta.title }}/h1 h2 classmt30 mb10基本使用/h2 Breadcrumb :routesroutes / h2 classmt30 mb10自定义分隔符/h2 Flex vertical Breadcrumb :routesroutes separator/ / Breadcrumb :routesroutes template #separator ArrowRightOutlined / /template /Breadcrumb Breadcrumb :routesroutes template #separator DoubleRightOutlined / /template /Breadcrumb /Flex h2 classmt30 mb10自定义样式/h2 Flex vertical Breadcrumb :routeslongNameRoutes breadcrumb-classcustom-breadcrumb-class :max-width210 :stylecustomStyle / Breadcrumb :routeslongNameRoutes :max-width210 :breadcrumb-style{ fontSize: 20px } :stylecustomStyle / Breadcrumb :routeslongNameRoutes :breadcrumb-style{ fontSize: 20px, height: 40px } :separator-style{ fontSize: 18px } :max-width210 / Breadcrumb :routeslongNameRoutes :breadcrumb-style{ fontSize: 20px, height: 40px } :separator-style{ fontSize: 18px } :max-width210 template #separator ArrowRightOutlined / /template /Breadcrumb Breadcrumb :routeslongNameRoutes :breadcrumb-style{ fontSize: 20px, height: 40px } :separator-style{ fontSize: 18px } :max-width210 template #separator{ index } ArrowRightOutlined v-ifindex 0 / DoubleRightOutlined v-ifindex 1 / /template /Breadcrumb /Flex h2 classmt30 mb10新页面打开目标链接/h2 Breadcrumb :routesroutes target_blank / /div /template style langless scoped .custom-breadcrumb-class { font-size: 20px; color: #1677ff; height: 40px; :deep(.breadcrumb-item) { .breadcrumb-link { color: rgba(22, 119, 255, 0.72); padding: 0 8px; border-radius: 8px; } .link-hover { :hover { color: #fff; background: #4096ff; } } .link-active { color: #1677ff; } .breadcrumb-separator { color: rgba(22, 119, 255, 0.72); } } } /style

相关新闻

2026/8/29 13:12:18

DistMoE:私有数据不出域的MoE分布式指令微调路由方案

这次我们来看一个偏研究向但工程价值很明确的课题: DistMoE ,全称是 “Private-data Rehearsal-free Routing in Mixture-of-Experts for Distributed Instruction Tuning”。 简单说,它解决的是一个很现实的问题:当多个参与方…

2026/8/29 13:12:18

Vue3视频播放(Video)

Vue2视频播放(Video) 可自定义设置以下属性: 视频播放器宽度(width),类型:string | number,单位 px,默认 800 视频播放器高度(height)&#x…

2026/8/29 13:07:18

机器视觉1

机器视觉是什么? 机器视觉的组成可分为硬件和软件两部分。 硬件负责成像,相当于人的“眼睛”,包括光源及光源控制器、镜头和工业相机;软件负责图像处理分析,相当于人的“视觉皮层”。具体而言,典型的机器…

2026/8/29 13:22:19

因子分析实战指南:从数据降维到潜变量提取

1. 从“数据太多”到“信息太少”:因子分析要解决的根本问题 做数据分析或者建模的朋友,肯定都遇到过这种头疼的情况:手里有一堆变量,比如一个学生评价体系,包含了“课堂专注度”、“作业完成质量”、“小组合作参与度…

2026/8/29 13:22:19

个人年度复盘:从事实、感受到认知的系统化成长方法

1. 项目概述:一次个人成长的深度复盘 又到年底了,朋友圈里各种“年度报告”开始刷屏,从听歌软件到支付账单,都在帮你总结过去。但说实话,这些由算法生成的、带着精美模板的“总结”,总让人觉得隔了一层。它…

2026/8/29 13:22:19

C++模板编程:从基础语法到泛型工厂实战

1. 项目概述:从“习题”到“内功”的跨越 看到“C习题06_模板”这个标题,很多朋友可能会觉得这又是一篇枯燥的语法练习题讲解。但我想说,如果你真的这么想,那可能就错过了C模板这个“屠龙技”最精髓的部分。模板,远不止…

2026/8/29 13:22:19

C++模板与空间配置器:STL高性能容器的核心机制解析

1. 从“容器”到“基石”&#xff1a;为什么我们需要模板和空间配置器 刚接触C的STL&#xff08;标准模板库&#xff09;时&#xff0c;很多人会被 vector<int> 、 list<string> 这种写法吸引&#xff0c;然后很快又对底层的内存管理感到困惑。你可能会想&…

2026/8/29 13:17:18

滚齿刀判断左右旋

判断左右旋先把滚刀立起来&#xff0c;肉眼观察。左边低右边高 右旋 。 右边低左边高 左旋。一般用的大部分都是右旋

2026/8/28 16:16:17

[光学原理与应用-521]:对光的错误理解与纠偏

首先光是一种能量的载体和形态&#xff0c;宏观上观察到的光是由无数个微观的光量子组成的&#xff0c;每个光子在产生的瞬间&#xff0c;其在真空的空间中以确定不变的速度沿着一个初始的方向一直向前&#xff0c;在微观层面&#xff0c;每个光量子的运动轨迹是以波函数所展现…

2026/8/28 16:16:21

SIP通话转接原理与REFER方法实战解析

1. 通话转接不是“挂断再拨号”&#xff0c;而是SIP会话的动态重定向你有没有遇到过这样的场景&#xff1a;客服坐席A正在和客户通电话&#xff0c;突然需要把这通对话无缝转给专家坐席B&#xff0c;客户完全感知不到中间的断连——既没听到忙音&#xff0c;也没被要求重新拨号…

2026/8/28 16:16:22

Kolla-ansible单节点OpenStack部署实战:从环境准备到排坑指南

1. 为什么选择Kolla-ansible来部署单节点OpenStack&#xff1f;如果你正在寻找一种能把OpenStack从“概念”快速变成“可用的实验环境”的方法&#xff0c;那么Kolla-ansible几乎是当前最主流、最省心的选择。我见过太多人卡在手动编译依赖、配置服务、处理版本冲突的泥潭里&am…

2026/8/29 0:01:10

etc目录下的profile.d文件目录设置环境变量和全局脚本shell

一、设置环境变量etc目录下的profile.d文件目录 /etc/profile.d1、编写 vi test.sh文件内容# jdk变量 export ZHK_HOME/root export PATH$PATH:$ZHK_HOME/test # 可以取出来ZHK_HOME变量给ZZZ_HOME赋值 export ZZZ_HOME${ZHK_HOME}/test2、刷新 执行source /etc/profile 命令使…

2026/8/29 0:01:10

【JavaScript】内存管理-垃圾回收机制-内存泄露

内存管理 C 语言这样的底层语言一般都有底层的内存管理接口&#xff0c;比如 malloc()和free()。 而 JavaScript 是在创建变量&#xff08;对象&#xff0c;字符串等&#xff09;时自动进行了分配内存&#xff0c;并且在不使用它们时“自动”释放。释放的过程称为垃圾回收。 整…

2026/8/29 0:01:10

Labgrid-MCP:为嵌入式硬件实验室接入AI Agent操控能力

Labgrid-MCP 的目标是把 MCP&#xff08;Model Context Protocol&#xff09;能力延伸到真实嵌入式硬件实验室&#xff1a;AI Agent 通过一个标准化的 MCP Server&#xff0c;就能查看目标板状态、控制上电断电、复位开发板、读取串口日志&#xff0c;甚至执行镜像刷写。对于经…

2026/8/28 16:16:48

实测才敢推 AI论文网站 2026最新测评与推荐

2026年真正好用的AI论文网站&#xff0c;核心看生成的论文质量、低AI味、格式正确、学术适配四大指标。综合实测&#xff0c;千笔AI、ThouPen、豆包、DeepSeek、Grammarly 是当前最值得推荐的梯队&#xff0c;覆盖从免费到付费、从中文到英文、从文科到理工的全场景需求。一、综…

2026/8/28 16:16:50

2026必备!AI论文网站测评:最新推荐与深度对比

2026年真正好用的AI论文网站&#xff0c;核心看生成的论文质量、低AI味、格式正确、学术适配四大指标。综合实测&#xff0c;千笔AI、ThouPen、豆包、DeepSeek、Grammarly 是当前最值得推荐的梯队&#xff0c;覆盖从免费到付费、从中文到英文、从文科到理工的全场景需求。 一、…

2026/8/28 11:06:45

摆脱论文困扰!盘点2026年全网爆红的的AI论文写作工具

一天写完毕业论文在2026年已不再是天方夜谭。2026年最炸裂、实测能大幅提速的AI论文写作工具&#xff0c;覆盖选题构思、文献整理、内容生成、格式排版等核心场景&#xff0c;真正帮你高效搞定论文难题。 一、全流程王者&#xff1a;一站式搞定论文全链路&#xff08;一天定稿首…