Embed forms in page main via compose_form.

listen collects forms from home and routed pages so mount_form is optional; validation errors re-render the owning page shell.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-12 09:02:37 +08:00
1 parent 0dcd9e3d03
commit b09538d242
13 files changed
+272 -40

No files matched your search

+10 -2
View File
@@ -39,6 +39,14 @@ Assemble main from a bind table (`|属性|值|样式|` or `|front|back|css|`).
**> web_compose_main page=`self` main=`main`**
## compose_form
+ `form`
+ `id`
Embed a form into the page main slot. `listen` auto-registers `GET|POST /_form/{id}` from page/route forms (optional `app.mount_form`).
**> web_compose_form page=`self` form=`form` id=`id`**
## render
+ `db`=None
@@ -184,12 +192,12 @@ Mount an assembled page at `path` (e.g. `/about`). `/` is the home `page=`.
+ `id`
+ `form`
Register `GET|POST /_form/{id}` for listen.
Register `GET|POST /_form/{id}` for listen when the form is not already embedded via `page.compose_form`.
**> web_app_mount_form app=`self` id=`id` form=`form`**
## listen
Serve `/`, routed pages, `/_part/{id}`, `/_form/{id}`, and optional `/admin`.
Serve `/`, routed pages, `/_part/{id}`, `/_form/{id}` (from mounts + page embeds), and optional `/admin`.
**> web_listen app=`self`**
+8
View File
@@ -35,6 +35,14 @@ description: 官方网站类(中文)。表格 + 方法;不写袋式胶水
**> web_compose_main page=`self` main=`主体`**
## 表单装配
+ `表单`
+ `id`
将表单嵌入页面主区。`listen` 会从页面/路由上的表单自动挂载 `GET|POST /_form/{id}`(可选再 `挂载表单`)。
**> web_compose_form page=`self` form=`表单` id=`id`**
## 渲染
+ `数据库`=None