Files
heroui-vue/docs/migrations/M31-header.md
T

36 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# M31 Header
日期:2026-10-23。上游 HeroUI 3.2.6 / `ce90ea3`。
## 契约核对
- `Header` / `HeaderRoot` 来自 `header/`;`headerVariants` 仅 `base: "header"`。
- 底层为 RAC `Header`,`DOMRenderProps<'header'>`:**原生 `<header>` 元素**,不是 heading 级别。已对照安装版 react-aria-components `Header.mjs` 确认 `dom.header`。
- 用途:集合/分组标题(Dropdown、ListBox、ComboBox、Autocomplete 分组),**不是**应用顶栏。
- 固定基线**没有**独立中文组件页与专属演示目录(已再次确认)。
## Vue 实现
- 导出 `Header`、`HeaderRoot`(同一组件)、`headerVariants`、`HeaderProps`。
- `data-slot="header"`;默认 `<header>`;`as` 可替换;attrs/class 动态合并。
- 无 v-model、无业务值、无焦点状态机。
- 样式 `.hv-header`:`w-full px-2 pt-1.5 pb-1 text-start text-xs font-medium text-muted`。
## 示例(自编 3,已在文档标注)
- header-basic:默认标题 + 语义容器
- header-custom-class:自定义 class
- header-semantic:分组列表组合边界(菜单未迁移时的说明)
## 测试
`tests/header.test.ts` 8 项:DOM/`header` 标签、as 覆盖、attrs 增删改、插槽更新、多实例、演示无 warning、类型、SSR。
## 差异
| 上游 | Vue |
| ---------------------- | ---------------------------------- |
| RAC Collection 叶子 | 语义 HTML 封装;集合上下文待菜单族 |
| `className`/`children` | `class`/默认插槽 |
| 无官方演示 | 自编 3 个,文档明确标注 |