# @vaebe/ccui 完整文档 > @vaebe/ccui 是 Vue 3 + TypeScript 组件库,视觉对齐 Ant Design v6.3.7。本文件聚合了官网全部组件文档,供 AI agent / LLM 一次性读入,构成代码生成与问答的知识库。 > 站点:https://vaebe.github.io/ccui/ > 仓库:https://github.com/vaebe/ccui 约定: - 所有组件以 `c-` 前缀使用,如 ``、``。 - 命令式组件(Message / Notification / Modal)通过 `useMessage()` / `useNotification()` / `useModal()` 等 hook 在 setup 中调用。 - 完整引入:`app.use(ccui)`;按需引入推荐配合 `@vaebe/unplugin-vue-components-ccui` 的 `Vue3CCUIResolver()`。 --- # 简介 `@vaebe/ccui` 是一套基于 **Vue 3 + TypeScript** 的开箱即用组件库,视觉与心智模型对齐 [Ant Design v6](https://ant-design.antgroup.com/),覆盖通用 / 布局 / 导航 / 数据录入 / 数据展示 / 反馈 / 其他七类、80+ 个组件。 ## 设计取向 - **对标而非照搬**:能力覆盖到、迁移成本低,但 React-only 的 API 形态(render props / forwardRef / 静态属性挂子组件等)会全部翻译成 Vue 习惯(slot、`v-model:*`、平铺导出)。详见 [对标原则](https://github.com/vaebe/ccui/blob/main/docs-notes/decisions/benchmark-principles.md)。 - **TypeScript 优先**:完整 `.d.ts` 类型导出,组件 props / events / slots 全量可推导。 - **主题原生 CSS 变量**:SeedToken / MapToken 双层体系,CSS 变量挂 `:root`,切换 `.dark` 类即启用暗色。 - **可访问性**:浮层 / 选择 / 列表 / 录入 等关键组件已完成 ARIA + 键盘审计。 - **国际化**:内置 zhCN / enUS / jaJP / koKR 四个语言包,`ConfigProvider` 切换同步驱动 dayjs locale 按需懒加载。 ## 主题 Token | Token | 默认值 | | ------------- | ----------------------------- | | colorPrimary | `#1677ff` | | colorSuccess | `#52c41a` | | colorWarning | `#faad14` | | colorError | `#ff4d4f` | | colorInfo | `#1677ff` | | borderRadius | `6px`(large 8 / small 4) | | fontSize | `14px`(行高 1.5714) | | controlHeight | `32px`(large 40 / small 24) | CSS 变量同时挂载到 `:root` 和 SCSS 变量 fallback,可直接通过 `var(--ccui-color-primary)` 等方式消费;切换到 `.dark` 类即可启用暗色主题。完整 token 列表与定制方式见 [ConfigProvider 全局配置](/components/config-provider/)。 ## 浏览器支持 跟随 Vue 3 官方支持范围:现代浏览器、不再支持 IE11。 ## 下一步 - 安装与引入方式见 [快速开始](/quick-start) - 给 AI / Copilot 接入 ccui 的索引文件见 [AI 接入](/for-ai) --- # Affix 固钉 > 文档链接:https://vaebe.github.io/ccui/components/affix/index.html 将页面元素钉在可视区域。常用于侧边目录、操作栏、工具条等需要常驻视野的场景。 ## 基本使用 相对顶部 0px 固定,滚动到阈值后元素贴住顶部。下面在一个可滚动容器内演示效果(页面本身带固定导航,直接相对窗口顶部 0px 固定会被导航遮住,故用容器演示)。 :::demo ```vue ``` ::: ## 偏移量 offsetTop 通过 `offset-top` 设置距顶部固定的距离。多个固定元素错开摆放。 :::demo ```vue ``` ::: ## 固定到底部 offsetBottom `offset-bottom` 把元素固定在视口底部,常用于「返回顶部」、底部操作栏。 :::demo ```vue ``` ::: ## 监听固定状态变化 通过 `change` 事件感知是否进入/退出固定状态,可联动展示阴影、收起等。 :::demo ```vue ``` ::: ## 在滚动容器中 通过 `target` 指定一个可滚动的父容器(CSS 选择器或 DOM 元素返回函数),固钉相对容器边界进行计算。 :::demo ```vue ``` ::: ## 自定义层级 zIndex 默认 `z-index: 10`;当页面里有 Drawer / Modal(更高 z-index)时按需调高,确保固钉不被遮罩盖住。 :::demo ```vue ``` ::: ## 多个 Affix 错开 工具栏吸顶 + 二级筛选条吸顶,靠 `offsetTop` 错开高度,构成「双层 sticky」效果。 :::demo ```vue ``` ::: ## 表格工具栏吸顶 后台管理页常见:表格行很长,工具栏(搜索 / 新建 / 批量操作)始终可达。 :::demo ```vue ``` ::: ## 章节锚点目录 侧边目录 sticky,配合右侧主内容滚动,是长文档 / 商品详情页常用排版。 :::demo ```vue ``` ::: ## 容器内 vs 全局对比 并列展示「以 window 为参照」和「以容器为参照」两种模式,便于业务侧理解 `target` 的影响范围。 :::demo ```vue ``` ::: ## API ### Props | 参数 | 类型 | 默认值 | 说明 | | ------------ | -------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------- | | offsetTop | number | `0` | 距离窗口(或目标容器)顶部多少像素后开始固定。`offsetBottom` 未传时启用顶部模式 | | offsetBottom | number | `undefined` | 距离窗口(或目标容器)底部多少像素后开始固定。设置该值则忽略 `offsetTop` | | target | `string \| HTMLElement \| () => HTMLElement \| Window \| null` | `window` | 滚动容器。可传 CSS 选择器、DOM 节点或返回 DOM 节点的函数 | | zIndex | number | `10` | 固定时元素的 `z-index` | ### Events | 事件名 | 回调签名 | 触发时机 | | ------ | ------------------ | ----------------------------- | | change | `(fixed: boolean)` | 固定状态变化(进入/退出固定) | ## 注意事项 - `c-affix` 内部用一个占位元素保持原始位置和尺寸,固定时把内容切换为 `position: fixed`。所以父容器不要给固钉外层加 `transform`,会让 `position: fixed` 失效。 - 如果固定后宽度异常,请检查父级是否使用 `display: flex` 等会改变子元素宽度计算的布局。 --- # Alert 警告提示 > 文档链接:https://vaebe.github.io/ccui/components/alert/index.html 警告提示,展现需要关注的信息。 ## 何时使用 - 当某个页面需要向用户显示警告的信息时。 - 非浮层的静态展现形式,始终展现,不会自动消失,用户可以点击关闭。 ## 基本使用 :::demo ```vue ``` ::: ## 含有辅助性文字介绍 :::demo ```vue ``` ::: ## 显示图标 :::demo ```vue ``` ::: ## 可关闭 :::demo ```vue ``` ::: ## 顶部公告(banner) `banner` 模式去边框、改背景,常用于页面顶部的全局提示。 :::demo ```vue ``` ::: ## 自定义关闭文字 `close-text` 替换默认的 × 按钮,常用于"知道了" / "我已了解"等业务文案。 :::demo ```vue ``` ::: ## 图标 + 描述完整版 `show-icon` + `description` + `closable` 三者组合是最饱满的提示形式。 :::demo ```vue ``` ::: ## 长内容自动换行 `message` 与 `description` 都会随容器宽度自动换行。 :::demo ```vue ``` ::: ## 表单顶部错误汇总(业务场景) 复杂表单提交失败时,把所有错误项放在顶部 Alert,便于用户快速定位。 :::demo ```vue ``` ::: ## 行内嵌入卡片 Alert 嵌在卡片或表单内部,作为局部提示。 :::demo ```vue ``` ::: ## Alert 参数 | 参数 | 类型 | 默认值 | 说明 | | ----------- | ---------------------------------------- | ------ | ------------------ | | type | 'success' / 'info' / 'warning' / 'error' | 'info' | 类型 | | message | string | -- | 警告主标题 | | description | string | -- | 辅助性文字描述 | | showIcon | boolean | false | 是否显示图标 | | closable | boolean | false | 默认显示关闭按钮 | | closeText | string | -- | 自定义关闭按钮文本 | | banner | boolean | false | 是否用作顶部公告 | ## Alert 事件 | 事件名 | 参数 | 说明 | | ------ | ---- | -------------- | | close | -- | 关闭按钮被点击 | --- # Anchor 锚点 > 文档链接:https://vaebe.github.io/ccui/components/anchor/index.html 页面内部跳转导航。点击锚点平滑滚动到对应内容,滚动时自动高亮当前所在区段。 ## 基本使用 最简单的用法:传入扁平的 `items` 列表,每项包含 `href`(CSS 选择器形式 `#id`)和 `title`。 :::demo ```vue ``` ::: ## 嵌套层级 `items` 支持 `children` 字段表达父子结构,子级会自动缩进。 :::demo ```vue ``` ::: ## 监听变化 监听 `change` 事件可在锚点切换时触发联动逻辑(如埋点、菜单同步)。 :::demo ```vue ``` ::: ## 调整高亮容差 `bounds` 控制元素到顶部多近时算"激活"(默认 `5`),`offsetTop` 让滚动停留位置距顶部预留空间,避免被 fixed header 遮挡。 :::demo ```vue ``` ::: ## 拦截点击 监听 `click` 事件可在跳转前后追加业务逻辑,比如埋点。锚点的默认行为已在内部阻止。 :::demo ```vue ``` ::: ## API ### Props | 参数 | 类型 | 默认值 | 说明 | | --------------- | ----------------------- | ----------- | ------------------------------------------ | | items | `AnchorLink[]` | `[]` | 锚点列表,支持 `children` 嵌套 | | affix | boolean | `true` | 是否固定(保留外观位) | | bounds | number | `5` | 元素到顶部小于此距离时视为激活(px) | | offsetTop | number | `0` | 高亮判定与点击滚动统一加的顶部偏移(px) | | targetOffset | number | `undefined` | 仅点击滚动用的偏移;未传则回退 `offsetTop` | | scrollContainer | `string \| HTMLElement` | `window` | 自定义滚动容器(CSS 选择器或元素引用) | | showInkInFixed | boolean | `false` | 固定时是否仍显示墨色滑块 | ### AnchorLink | 字段 | 类型 | 说明 | | -------- | -------------- | --------------------------- | | href | string | 必填,目标元素 id(带 `#`) | | title | string | 显示文本,省略则用 href | | children | `AnchorLink[]` | 子级锚点(可任意层嵌套) | ### Events | 事件名 | 回调签名 | 触发时机 | | ------ | --------------------------------------- | ---------------------- | | change | `(activeHref: string)` | 当前激活锚点变化时 | | click | `(event: MouseEvent, link: AnchorLink)` | 点击锚点时(已阻默认) | ### Slots | 名称 | 说明 | | ------- | -------------------------------------------------------- | | default | 自定义渲染(不使用 `items`,需自行写带 `href` 的 ``) | --- # AutoComplete 自动完成 > 文档链接:https://vaebe.github.io/ccui/components/auto-complete/index.html 输入框 + 浮层下拉建议项。区别于 Select:值可以是任意字符串(不限于选项),适合做地址、邮箱、商品名、关键词等"补全"场景。 ## 基本使用 `v-model` 绑定输入值,`options` 提供候选项。`options` 可以是 `string[]` 或 `{ value, label, disabled? }[]`。 :::demo ```vue ``` ::: ## 自定义选项格式 提供 `{ value, label, disabled }` 形态可以独立控制 value 和显示文本,并禁用某项。 :::demo ```vue ``` ::: ## 过滤逻辑 `filter-option` 控制候选项过滤: - `true`(默认):按 label 包含输入内容(不区分大小写) - `false`:不过滤,全量展示 - `function`:自定义过滤函数 `(input, option) => boolean` :::demo ```vue ``` ::: ## 大小写敏感 `case-sensitive=true` 让默认过滤区分大小写。 :::demo ```vue ``` ::: ## 键盘导航 打开浮层后: - `↑` `↓` 在候选项间移动焦点(自动跳过 disabled 项,到末尾循环回首项) - `Enter` 选中当前焦点项 - `Esc` 关闭浮层 - 输入字符任意时刻打开浮层 ## 三种尺寸 :::demo ```vue ``` ::: ## 表单联动 放进 `c-form-item` 内时,`status` 会自动跟随 `FormItem` 的校验状态。 :::demo ```vue ``` ::: ## 弹层容器 把面板挂到 `document.body` 或自定义容器,避开 overflow 滚动裁切。 :::demo ```vue ``` ::: ## Variants 录入组件统一 `variant` 形态。四档:`outlined`(默认)/ `filled` / `borderless` / `underlined`。 :::demo ```vue ``` ::: ## API ### Props | 参数 | 类型 | 默认值 | 说明 | | ------------------------ | ---------------------------------------------------------- | ------------------------- | ------------------------------------------------ | | modelValue | string \| number \| null | -- | 当前输入值,支持 `v-model` | | defaultValue | string \| number | `''` | 非受控初始值 | | options | `(string \| number \| { value, label?, disabled? })[]` | `[]` | 候选项;string/number 形态的 label = value | | placeholder | string | -- | 占位文案 | | disabled | boolean | `false` | 是否禁用 | | allowClear | boolean | `false` | 显示一键清空按钮 | | size | `'small' \| 'default' \| 'large'` | `'default'` | 输入框尺寸 | | status | `'' \| 'error' \| 'warning' \| 'success' \| 'validating'` | `''` | 校验状态;置于 `FormItem` 时自动继承 | | filterOption | `boolean \| (input, option) => boolean` | `true` | 过滤逻辑 | | caseSensitive | boolean | `false` | 是否区分大小写(仅默认 includes 过滤生效) | | notFoundContent | string | `暂无数据` | 空数据占位 | | placement | `'bottomLeft' \| 'bottomRight' \| 'topLeft' \| 'topRight'` | `'bottomLeft'` | 浮层方位 | | popupClassName | string | -- | 浮层根元素自定义 class | | popupAppendToBody | boolean | `false` | Teleport 到 `document.body` | | getPopupContainer | `(trigger: HTMLElement \| null) => HTMLElement \| null` | -- | 自定义浮层挂载点,优先级高于 `popupAppendToBody` | | transitionName | string | `ccui-auto-complete-fade` | 浮层过渡名 | | popupMaxHeight | number | `256` | 浮层最大高度(px) | | defaultActiveFirstOption | boolean | `false` | 打开浮层时是否默认高亮第一项 | | backfill | boolean | `false` | 键盘导航时是否把高亮项 label 写回 input | | searchDebounce | number | `0` | 搜索防抖延迟(毫秒),`0` 不防抖 | ### Events | 事件名 | 回调签名 | 触发时机 | | ----------------- | ------------------------------------------------------- | ----------------------------------- | | update:modelValue | `(value: string \| number)` | 输入或选中时 | | change | `(value: string \| number)` | 同 update:modelValue | | search | `(keyword: string)` | 同 update:modelValue(search 别名) | | select | `(value: string \| number, option: AutoCompleteOption)` | 选中候选项时 | | open-change | `(open: boolean)` | 浮层打开 / 关闭时 | | focus | `(e: FocusEvent)` | 输入框聚焦 | | blur | `(e: FocusEvent)` | 输入框失焦 | ### Slots | 名称 | 参数 | 说明 | | ------- | ----------------------------------------------------------------------- | --------------------------- | | option | `{ option: AutoCompleteOption, index: number }` | 自定义单项渲染 | | trigger | `{ value, onInput, onFocus, onBlur, onKeydown, placeholder, disabled }` | 自定义输入框(如 textarea) | ## 已知限制(未交付) - **virtual list(候选项虚拟滚动)**:选项 > 1000 时性能未优化,复用 Tree/Select 的 use-virtual-list 留后续。 --- # Avatar 头像 > 文档链接:https://vaebe.github.io/ccui/components/avatar/index.html 代表用户或对象的图标,支持图片、文字、自定义文本。 ## 何时使用 - 用户列表、评论、消息中显示用户身份 - 当头像没有图片时,用文字首字母替代 ## 基本使用 最简单的方式 —— 传 `name`,组件按规则提取最后/前两个字符。 :::demo ```vue ``` ::: ## 不同尺寸 `width` / `height` 控制头像大小(单位 px)。 :::demo ```vue ``` ::: ## 方形头像 `is-round=false` 渲染为方形,常用于品牌、产品图标。 :::demo ```vue ``` ::: ## 图片头像 `img-src` 指定图片地址。图片加载失败时回退到文字。`fit` 控制图片填充方式(同 CSS `object-fit`)。 :::demo ```vue ``` ::: ## 自定义显示文字 `custom-text` 优先级高于 `name`,按原文展示,不做提取。 :::demo ```vue ``` ::: ## 性别配色 `gender` 影响默认背景色。 :::demo ```vue ``` ::: ## 单字符 / Emoji 头像 `custom-text` 可放任意字符(emoji / 符号 / 单汉字),适合代表「身份徽章」「机器人 / 系统」「VIP」等。 :::demo ```vue ``` ::: ## 加载失败回退 `img-src` 加载失败时,自动回退到文字头像(`custom-text` > `name` 的字符提取)。 :::demo ```vue ``` ::: ## 用户列表场景 头像 + 姓名 + 描述的典型列表项排版。 :::demo ```vue ``` ::: ## 评论头像 评论场景下头像在左、内容在右的典型布局。 :::demo ```vue ``` ::: ## 显示规则 - 优先级:`imgSrc > customText > name` - 文字提取规则: 1. 中文开头:取最后两个字符 2. 英文开头:取前两个字符 3. 多个英文名连用:取每个英文名的首字母 4. 非中英文开头:取前两个字符 ## API ### Props | 参数 | 类型 | 默认值 | 说明 | | ---------- | ---------------------------------------------------------- | ------- | ------------------------------------------ | | name | string | - | 用于生成头像文字(可不传,回退到默认占位) | | gender | `'male' \| 'female' \| string` | - | 影响默认背景色 | | width | number | `36` | 宽度(px) | | height | number | `36` | 高度(px) | | isRound | boolean | `true` | 是否圆形 | | imgSrc | string | - | 自定义图片 | | customText | string | - | 自定义文字(不做提取) | | fit | `'fill' \| 'contain' \| 'cover' \| 'none' \| 'scale-down'` | `cover` | 图片填充方式 | --- # Badge 徽标数 > 文档链接:https://vaebe.github.io/ccui/components/badge/index.html 图标右上角的圆形徽标数字。 ## 何时使用 - 一般出现在通知图标或头像的右上角,用于显示需要处理的消息条数。 - 用于其他需要展示状态的场景。 ## 基本使用 :::demo ```vue ``` ::: ## 独立使用 :::demo ```vue ``` ::: ## 小红点 :::demo ```vue ``` ::: ## 状态点 :::demo ```vue ``` ::: ## 自定义颜色 `color` 接受任意 CSS 颜色字符串(预设色名 / 十六进制 / rgb 都行)。 :::demo ```vue ``` ::: ## 偏移设置(offset) `offset: [x, y]` 调整徽标相对默认位置的偏移量(单位 px)。 :::demo ```vue ``` ::: ## 字符串 count(NEW / HOT 标签) `count` 也接受字符串,常用作产品列表的「NEW / HOT / 限时」角标。 :::demo ```vue ``` ::: ## 与 Avatar 组合(消息中心常见) 头像 + 消息数徽标,常见于头部导航的「消息中心 / 通知」按钮。 :::demo ```vue ``` ::: ## Badge 参数 | 参数 | 类型 | 默认值 | 说明 | | ------------- | ---------------------------------------------------------- | ------ | -------------------------- | | count | number / string | -- | 展示数字,0 默认隐藏 | | showZero | boolean | false | 当数值为 0 时是否展示 | | overflowCount | number | 99 | 展示封顶的数字值 | | dot | boolean | false | 不展示数字,只有一个小红点 | | status | 'success' / 'processing' / 'default' / 'error' / 'warning' | -- | 状态点的颜色 | | text | string | -- | 状态点的文字 | | color | string | -- | 自定义小圆点颜色 | | offset | [number, number] | -- | 设置徽标数偏移 | --- # BadgeRibbon 缎带徽标 > 文档链接:https://vaebe.github.io/ccui/components/badge-ribbon/index.html 带折角缎带的徽标,作为独立顶层组件存在(不挂在 Badge 命名空间下)。 ## 何时使用 - 卡片 / 商品 / 列表项需要在角落标注「新」「热」「限时」等带视觉冲击的徽标。 ## 基本使用 `text` 设置缎带文字,默认 slot 是被装饰的内容。 :::demo ```vue ``` ::: ## 不同位置 `placement: 'start' | 'end'`,默认 `end`(右上)。 :::demo ```vue ``` ::: ## 预设色 13 种预设色名:`pink` / `magenta` / `red` / `volcano` / `orange` / `yellow` / `gold` / `cyan` / `lime` / `green` / `blue` / `geekblue` / `purple`。 :::demo ```vue ``` ::: ## 自定义色 非预设字符串作为 CSS color 字面量(`#hex` / `rgb()` / 命名色)。 :::demo ```vue ``` ::: ## 文字 slot 需要图标 + 文字时用 `text` slot 完全自定义。 :::demo ```vue ``` ::: ## BadgeRibbon 参数 | 参数 | 类型 | 默认 | 说明 | | --------- | ---------------- | ---- | ------------------------------------------------------------------ | | text | string | '' | 缎带文字(slot `text` 优先) | | color | string | '' | 预设色名 / CSS color 字符串;预设色走 modifier,其余走 inline 背景 | | placement | 'start' \| 'end' | end | 缎带位置(右上 / 左上) | ## BadgeRibbon 插槽 | 插槽名 | 说明 | | ------- | ----------------------------------------- | | default | 被装饰的内容(缎带浮于其右/左上角) | | text | 缎带内文字 / 节点,优先级高于 `text` prop | --- # BorderBeam 边框流光 > 文档链接:https://vaebe.github.io/ccui/components/border-beam/index.html 一道渐变光沿容器边框循环流动,用于给卡片、容器等内容加一层灵动的视觉强调。 ## 何时使用 - 想突出某个卡片 / 面板,让它在页面中更吸睛。 - 营销页、活动入口、AI 能力卡片等需要动态氛围感的场景。 ## 基本使用 默认插槽放置被包裹的内容,流光会绕着容器边框流动。`borderRadius` 默认 `8`,与 `c-card` 圆角一致,直接包裹卡片即可严丝合缝;不传 `color` 时使用主题主色渐变。 :::demo ```vue ``` ::: ## 自定义配色 通过 `color` 传入单个颜色字符串。 :::demo ```vue ``` ::: ## 渐变停靠点 `color` 传入停靠点数组(`percent` 取值 0 ~ 100)可得到多色渐变光带。 :::demo ```vue ``` ::: ## 内置配色预设 内置 6 套配色预设(Ocean / Sunset / Aurora / Forest / Ember / Nebula),从 `@vaebe/ccui` 导出 `borderBeamPresets`,直接把 `preset.color` 传给 `color` 即可。下方可切换预览。 :::demo ```vue ``` ::: ## 调速 `duration` 控制跑完一圈的时长(秒),值越小越快。 :::demo ```vue ``` ::: ## 外扩与圆角 `outset` 让流光层相对容器边缘向外扩展,`borderWidth` 调整光带粗细,`borderRadius` 决定边框环圆角。 :::demo ```vue ``` ::: ## API ### Props | 参数 | 说明 | 类型 | 默认值 | | ------------ | ---------------------------------------------------------- | ----------------------------------- | ------ | | color | 流光颜色,单色字符串或渐变停靠点数组;不传时用主题主色渐变 | [BorderBeamColor](#borderbeamcolor) | - | | outset | 流光层相对容器边缘的外扩距离(number 视为 px) | `number \| string` | `0` | | borderWidth | 边框 / 光带粗细(px) | `number` | `1` | | borderRadius | 容器圆角(px),与被包裹内容保持一致即可严丝合缝 | `number` | `8` | | duration | 跑完一圈的时长(秒) | `number` | `6` | ### Slots | 插槽名 | 说明 | | ------- | ---------------- | | default | 被流光包裹的内容 | ## BorderBeam 类型定义 ### BorderBeamColor ```ts export interface BorderBeamColorStop { /** 颜色值,支持任意 CSS 颜色 */ color: string /** 渐变停靠位置,取值 0 ~ 100 */ percent: number } export type BorderBeamColor = string | BorderBeamColorStop[] ``` ## 内置预设 从 `@vaebe/ccui` 导出,按定义顺序提供 6 套配色: ```ts import { borderBeamPresetKeys, borderBeamPresets } from '@vaebe/ccui' // borderBeamPresetKeys: ['ocean', 'sunset', 'aurora', 'forest', 'ember', 'nebula'] // borderBeamPresets.ocean.color → BorderBeamColorStop[] export interface BorderBeamPreset { key: string name: string color: BorderBeamColorStop[] } ``` --- # Breadcrumb 面包屑 > 文档链接:https://vaebe.github.io/ccui/components/breadcrumb/index.html 显示当前页面在系统层级中的位置,并提供向上导航能力。 ## 何时使用 - 系统层级 ≥ 3 级时辅助用户定位。 - 详情页头部展示 "返回路径",支持多级跳转回。 ## 基本使用 最常见的写法:用一组 `` 组合,最末一级是当前页(不带链接)。 :::demo ```vue ``` ::: ## 用 routes 数据驱动 适合从路由表 / 后端响应直接生成路径。`routes[i].href` 提供链接,`routes[i].breadcrumbName` 提供文字;最末一项不渲染为 ``。 :::demo ```vue ``` ::: ## 自定义分隔符 `separator` 可以是任意字符串。 :::demo ```vue ``` ::: ## 单项自定义分隔符 某项的 `separator` 属性会覆盖整组的分隔符。 :::demo ```vue ``` ::: ## 用 #separator 插槽 用 slot 写自定义分隔符,可以放图标 / SVG / 文字组合。 :::demo ```vue ``` ::: ## 配合按钮 面包屑右侧常和操作按钮并列,可用 flex 布局。 :::demo ```vue ``` ::: ## API ### Breadcrumb Props | 参数 | 类型 | 默认值 | 说明 | | --------- | ------------------- | ------ | ------------------------------ | | separator | string | `'/'` | 分隔符 | | routes | `BreadcrumbRoute[]` | `[]` | 路由数据,提供时优先于默认插槽 | ### BreadcrumbRoute | 字段 | 类型 | 说明 | | -------------- | ------ | ------------------------------------ | | breadcrumbName | string | 显示文本 | | title | string | `breadcrumbName` 的别名 | | href | string | 链接地址 | | path | string | 链接地址(兼容字段,与 `href` 等价) | ### BreadcrumbItem Props | 参数 | 类型 | 默认值 | 说明 | | --------- | ------ | ------ | ---------------------------- | | href | string | `''` | 设置后整项渲染为 `` | | separator | string | `''` | 单项级别覆盖父级 `separator` | ### BreadcrumbItem Slots | 名称 | 说明 | | --------- | ---------------------------- | | default | 内容 | | separator | 自定义分隔符(覆盖字符形式) | --- # Button 按钮 > 文档链接:https://vaebe.github.io/ccui/components/button/index.html 常用的操作按钮。 ## 何时使用 按钮用于开始一个即时操作。 ## 基本使用 :::demo ```vue ``` ::: ## 不同尺寸 :::demo ```vue ``` ::: ## 禁用状态 :::demo ```vue ``` ::: ## 圆角按钮 :::demo ```vue ``` ::: ## 圆形按钮 :::demo ```vue ``` ::: ## 朴素按钮 :::demo ```vue ``` ::: ## 加载状态 :::demo ```vue ``` ::: ## 图标按钮 :::demo ```vue ``` ::: ## 自定义颜色 color `color` 接受任意 CSS color 字符串。实心 type(`primary`/`success`/`warning`/`danger`/`info`)注入 `background-color + border-color`;描边 type(`''`/`default`/`dashed`)注入 `color + border-color`;`text`/`link` 仅注入 `color`。hover/active 联动由使用方用 CSS class 自兜底。 :::demo ```vue ``` ::: ## Button参数 | 参数 | 类型 | 默认 | 说明 | | --------------- | ----------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------- | | size | [ButtonSizeType](#buttonsizetype) | -- | 尺寸 | | type | [ButtonType](#buttontype) | -- | 类型:`'primary' \| 'default' \| 'dashed' \| 'link' \| 'text'`,加语义色 `'success' \| 'warning' \| 'danger' \| 'info'` | | plain | boolean | false | 朴素按钮:背景透明,文字与边框跟主色 | | round | boolean | false | 圆角按钮 | | circle | boolean | false | 圆形按钮(常用于纯图标场景) | | native-type | [ButtonNativeType](#buttonnativetype) | button | 原生 `