iter(g139): 提示气泡支持左右方位

This commit is contained in:
HIsheR
2026-10-26 15:32:47 +08:00
parent a3db5e66fc
commit 08ceb8f127
9 changed files with 62 additions and 18 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
# @ui-arch 组件库 Agent 文档(无图形版)
> 自动生成于 2026-10-26T07:31:10.742Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
> 自动生成于 2026-10-26T07:32:30.909Z,数据源:各包 ua.manifest.json,勿手改。人类版文档站:apps/docs/index.html。
> 组件 = 普通函数,传 props 返回 DOM;状态用 signal 双向绑定:读 signal() 写 signal(v)。
## 快速上手
@@ -588,7 +588,7 @@ toast.success('保存成功'); toast.error('网络请求失败', 5000)
参数:
- content(必填):string —— 提示文案(纯文本)
- placement(默认 top):'top' | 'bottom' —— 气泡方位;缺省 top(触发器上方)
- placement(默认 top):'top' | 'bottom' | 'left' | 'right' —— 气泡方位;缺省 top,出场时按视口剩余空间自动翻到对侧(水平方位按宽度判左右)
- delay(默认 150):number —— 出场延迟毫秒;缺省 150,传 0 立即显示
- trigger(必填):HTMLElement —— 第二个参数:被包裹的触发器元素(按钮 / 输入框等任意 DOM)
@@ -604,6 +604,7 @@ tooltip({ content: '保存后立即生效' }, button({ label: '保存', onClick:
2. 鼠标悬停或键盘聚焦后延迟 delay 毫秒出场,移出 / 失焦 / Esc 收起;空间不足时自动翻到另一侧
3. 触摸屏没有 hover:手指按下即出场,抬手后停留 1.2 秒再收起,免得手指正挡着就消失
4. 气泡设了 pointer-events: none,不会挡住下面的点击;aria-describedby 已关联,读屏能念出提示文案
5. 方位支持上下左右四向:贴边或工具栏竖排时用 left / right,出场时按该方向剩余空间自动翻到对侧
现场演示:apps/docs/demo.html#sec-tooltip