iter(g128): 收尾刷新变更日志

This commit is contained in:
HIsheR
2026-10-26 14:52:17 +08:00
parent 6a5e12b5a1
commit b39964011c
3 changed files with 47 additions and 0 deletions
+8
View File
@@ -1380,6 +1380,14 @@
"acceptance": "recipes.md 新增「配方 6:长表单编辑页(吸底操作条 + 提交锁定)」:affix position bottom 固定操作条、form 聚合校验与汇总条、同一 saving 信号锁按钮/开关/请求出口、maxCount 与 rules max 同源约束;npm run docs 后 llms-full.txt 出现该配方;npm run check 全绿", "acceptance": "recipes.md 新增「配方 6:长表单编辑页(吸底操作条 + 提交锁定)」:affix position bottom 固定操作条、form 聚合校验与汇总条、同一 saving 信号锁按钮/开关/请求出口、maxCount 与 rules max 同源约束;npm run docs 后 llms-full.txt 出现该配方;npm run check 全绿",
"notes": "自补:文档完善;只写用法不碰实现,配方随 docs 注入 llms-full", "notes": "自补:文档完善;只写用法不碰实现,配方随 docs 注入 llms-full",
"status": "done" "status": "done"
},
{
"id": "g128",
"title": "收尾刷新变更日志",
"motivation": "g123 之后又落了 10 次提交(rate 半星、checkbox 半选、开关 loading、precision、配方 6 等),changelog:check 已报漂移",
"acceptance": "npm run changelog 重新生成(329 提交),changelog:check 一致(提交本条后按约定再差一条,属正常);npm run check 全绿",
"notes": "自补:发版前刷新步骤;本次唤起收尾轮,顺带提交 g127 漏带的 llms-full.txt",
"status": "open"
} }
] ]
} }
+10
View File
@@ -4,6 +4,11 @@
## 迭代 ## 迭代
- `48b0f35` iter(g127): 补长表单编辑页组合配方
- `023a2eb` iter(g126): 数字输入补 precision 小数位
- `490c9fa` iter(g125): 开关补 loading 加载态
- `63d3c91` iter(g124): 复选框补 indeterminate 半选态
- `ba102e0` iter(g123): 收尾刷新变更日志
- `72c5d24` iter(g122): 评分组件支持 allowHalf 半星 - `72c5d24` iter(g122): 评分组件支持 allowHalf 半星
- `151d901` iter(g121): textField 补 maxCount 字数统计 - `151d901` iter(g121): textField 补 maxCount 字数统计
- `5a6c7a5` iter(g120): 补新增组件落点清单 - `5a6c7a5` iter(g120): 补新增组件落点清单
@@ -148,6 +153,11 @@
## 维护 ## 维护
- `6a5e12b` chore(backlog): 记录 g127 完成
- `fc58442` chore(backlog): 记录 g126 完成
- `686b0f7` chore(backlog): 记录 g125 完成
- `56e5d18` chore(backlog): 记录 g124 完成
- `85731a2` chore(backlog): 记录 g123 完成
- `0338f21` chore(backlog): 记录 g122 完成 - `0338f21` chore(backlog): 记录 g122 完成
- `f4a5101` chore(backlog): 记录 g121 完成 - `f4a5101` chore(backlog): 记录 g121 完成
- `3e1e4ea` chore(backlog): 记录 g120 完成 - `3e1e4ea` chore(backlog): 记录 g120 完成
+29
View File
@@ -1972,6 +1972,35 @@ const pager = pagination({ page, pageSize: 5, total: rows.length, jumpable: true
- 列宽拖拽只对 `width` 给数字的列生效(`'flex'` 列交给浏览器自适应);双击手柄回到声明宽度。 - 列宽拖拽只对 `width` 给数字的列生效(`'flex'` 列交给浏览器自适应);双击手柄回到声明宽度。
- 行选择一律按 rowKey 记账,筛选换掉可见行后已选仍在,批量操作前用已选计数确认。 - 行选择一律按 rowKey 记账,筛选换掉可见行后已选仍在,批量操作前用已选计数确认。
## 配方 6:长表单编辑页(吸底操作条 + 提交锁定)
```ts
const saving = signal(false);
form(
{
onSubmit: (ok) => {
if (!ok) return; // 失败时汇总条已定位到第一处错误,无需自己数红框
saving(true);
save().then(() => toast.success('已保存')).finally(() => saving(false));
},
},
[
formItem({ label: '标题', value: title, required: true, rules: [{ max: 20 }] }, textField({ value: title, maxCount: 20 })),
formItem({ label: '权重', value: weight, hint: '0–100%,一位小数' }, inputNumber({ value: weight, min: 0, max: 100, step: 0.1, precision: 1 })),
formItem({ label: '上架', value: online }, switchButton({ label: '保存后自动上架', checked: online, loading: saving })),
],
);
affix({ position: 'bottom', offset: 0 }, h('div', { class: 'row' },
button({ label: '保存', type: 'submit', disabled: saving }),
));
```
要点:
- 长表单的操作条用 `affix({ position: 'bottom' })` 贴底固定,翻到表单底部按钮也不丢;提交按钮 `type: 'submit'` 走 `form` 聚合校验。
- 校验失败时 `form` 顶部的汇总条会播报「有 N 项需要修改」并聚焦第一处(`errorSummary: false` 可关);`hint` 写格式说明,报错时自动让位。
- 提交期间用同一个 `saving` 信号锁三处:按钮 `disabled`、开关 `loading`(转圈 + aria-busy)、业务请求出口,防重复提交与中途改状态。
- 长度约束一处写够:`textField` 的 `maxCount` 设原生上限并实时计数,`formItem` 的 `rules: [{ max }]` 只做提交兜底,两处数字保持一致。
## 通用约定 ## 通用约定
- 状态一律放信号(`signal` / `computed`),组件只读写信号,不持有业务数据副本。 - 状态一律放信号(`signal` / `computed`),组件只读写信号,不持有业务数据副本。