iter(g113): 吸顶容器支持贴底固定

This commit is contained in:
HIsheR
2026-10-26 14:06:32 +08:00
parent 5c25e88c98
commit ec7aaf0a7d
6 changed files with 34 additions and 8 deletions
+3 -1
View File
@@ -1,6 +1,6 @@
# @ui-arch 组件库 Agent 文档(无图形版)
> 自动生成于 2026-10-26T06:05:26.104Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
> 自动生成于 2026-10-26T06:06:20.403Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
> 组件 = 普通函数,传 props 返回 DOM;状态用 signal 双向绑定:读 signal() 写 signal(v)。
## 快速上手
@@ -1527,6 +1527,7 @@ checkboxGroup({ value: permPick, min: 1, max: 3, checkAll: true, options: [{ val
参数:
- offset:number —— 距视口顶部多少像素后转为固定;缺省 0
- position:'top' | 'bottom' —— 固定边:贴顶放头部工具栏,贴底放底部操作条;缺省 top
- target:HTMLElement | Window —— 监听的滚动容器;缺省 window(整页)
- children:...unknown[] —— 被固定的内容,作为第二个及之后的实参传入
@@ -1542,6 +1543,7 @@ affix({ offset: 8 }, card({ title: '滚动时我会贴顶' }, h('p', null, '正
2. 滚动到 offset 以内(默认贴视口顶)时内层转 fixed,外层同步撑出等高占位,页面不会塌跳
3. 固定期间宽度与横向位置跟随占位容器,窗口缩放或父容器变宽都自动贴合
4. 内滚容器场景把该元素传给 target,判定改为基于它的滚动位置
5. 底部操作条传 position: 'bottom':占位容器底边越过「视口底 - offset」时才固定,对应的内联边距写 bottom
现场演示:apps/docs/demo.html#sec-affix