iter(g136): 新增链接组件 link
This commit is contained in:
@@ -1444,6 +1444,14 @@
|
||||
"acceptance": "form 新增 columns(1/2/3),>1 时字段走 grid 铺列、窄屏自动单列、按钮区始终整行;单向依赖(form 复用 grid);manifest props/steps 与 demo 同步;npm run check 全绿",
|
||||
"notes": "自补:既有组件可用性细节",
|
||||
"status": "done"
|
||||
},
|
||||
{
|
||||
"id": "g136",
|
||||
"title": "新增链接组件 link",
|
||||
"motivation": "页面里的 a 标签各写各的样式:站外链接普遍漏 rel=noopener、没有 ↗ 提示,读屏也不知道开了新窗口;禁用态要么当纯文本要么还能点",
|
||||
"acceptance": "link 支持 href/label/target/external/muted/disabled/onClick,站外自动补 ↗ 与 rel 并播报新窗口,禁用去 href 保留 aria-disabled;样式只消费 --ua-*;文档与演示同步;npm run check 全绿",
|
||||
"notes": "自补:组件补充方向",
|
||||
"status": "open"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
+59
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "ui-arch-registry-index/0.1",
|
||||
"generatedAt": "2026-10-26T07:26:53.819Z",
|
||||
"generatedAt": "2026-10-26T07:28:06.168Z",
|
||||
"repoRoot": ".",
|
||||
"packages": [
|
||||
{
|
||||
@@ -208,7 +208,8 @@
|
||||
"grid(props, ...children):栅格容器,columns 固定列数或 min 走 auto-fit 自适应列宽,gutter 统一列间距,窄屏自动降为单列",
|
||||
"floatButton(props):悬浮操作按钮,固定停靠左下 / 右下角,label 缺省为纯图标圆形,badge 走角标,tooltip 兼作 aria-label",
|
||||
"mentions(props):@提及输入,textarea 内键入 @ 弹候选(名字 / 关键词过滤),↑↓ 环形移动、Enter/Tab 选中、Esc 只收本层,选中按光标替换并写回 value",
|
||||
"treeSelect(props):树形选择,按钮触发弹层并复用 tree(搜索 / 多选 / 级联),单选选中即收起、多选保持展开,Esc 与点外收起"
|
||||
"treeSelect(props):树形选择,按钮触发弹层并复用 tree(搜索 / 多选 / 级联),单选选中即收起、多选保持展开,Esc 与点外收起",
|
||||
"link(props):链接,站内跳转与站外跳转统一入口,external 自动补 ↗ 与 rel=noopener noreferrer 并给读屏播报"
|
||||
],
|
||||
"keyTypes": [
|
||||
"ButtonProps",
|
||||
@@ -3389,6 +3390,62 @@
|
||||
"选中值只存 key(单选 value / 多选 checked 数组),显示名由 nodes 反查——改 label 不需要迁移数据",
|
||||
"禁用单个节点用 nodes 里的 disabled(该节点不可选,子节点仍可选);禁用整个控件用 disabled"
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "link",
|
||||
"title": "链接 Link",
|
||||
"demo": "sec-link",
|
||||
"props": [
|
||||
{
|
||||
"n": "href",
|
||||
"t": "string",
|
||||
"r": 1,
|
||||
"d": "目标地址:站内相对路径或绝对 URL"
|
||||
},
|
||||
{
|
||||
"n": "label",
|
||||
"t": "string",
|
||||
"r": 1,
|
||||
"d": "链接文案"
|
||||
},
|
||||
{
|
||||
"n": "target",
|
||||
"t": "'_self' | '_blank' | '_parent' | '_top'",
|
||||
"d": "打开方式;缺省同窗口。传 _blank 会自动按站外处理(补 rel 与图标)"
|
||||
},
|
||||
{
|
||||
"n": "external",
|
||||
"t": "boolean",
|
||||
"df": "false",
|
||||
"d": "站外链接:补 ↗ 图标、强制新窗口、加 rel=noopener noreferrer,并给读屏播报「在新窗口打开」"
|
||||
},
|
||||
{
|
||||
"n": "muted",
|
||||
"t": "boolean",
|
||||
"df": "false",
|
||||
"d": "弱化色,用于次要链接与页脚"
|
||||
},
|
||||
{
|
||||
"n": "disabled",
|
||||
"t": "boolean",
|
||||
"df": "false",
|
||||
"d": "禁用:去掉 href、拦点击,保留可聚焦与 aria-disabled(仍能被 Tab 到,读屏能听出不可用)"
|
||||
},
|
||||
{
|
||||
"n": "onClick",
|
||||
"t": "(e: Event) => void",
|
||||
"k": 1,
|
||||
"d": "点击回调(禁用时不触发;可用于埋点,returnValue 不影响默认跳转)"
|
||||
}
|
||||
],
|
||||
"example": "link({ href: '/docs', label: '查看文档' }); link({ href: 'https://example.com', label: '外部站点', external: true }); link({ href: '#', label: '说明页', muted: true })",
|
||||
"steps": [
|
||||
"站内跳转用相对路径、站外用 external: true:会自动补 ↗、target=_blank、rel=noopener noreferrer,并给读屏播报开了新窗口",
|
||||
"页脚 / 次要说明用 muted 弱化;正文里的行内链接保持默认主色,与 typography 的 underline 区分用途(后者不跳转)",
|
||||
"需要「点了先确认再跳」这类拦截,在 onClick 里做判断后自行处理,组件不接管默认行为(除禁用外都放行)",
|
||||
"禁用态只是去掉 href 并保持 aria-disabled,不做视觉上的「像普通文字」处理——需要完全不可聚焦请在外层控制渲染",
|
||||
"纯样式的「看起来像链接」用 typography({ underline: true }),不要为了样式引入带 href 的 a 标签"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user