Add ext/web with table-driven pages and polished admin CRUD.

Ship the web L1/plugin stack (bind tables, variable-named db.init, live render) and tighten the admin UI with sidebar, toolbar, forms, and activity log.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
cflmyandCursor committed 2026-08-11 11:42:17 +08:00
1 parent ab8ea8438f
commit 8041a2274c
26 files changed
+5689 -242

No files matched your search

+65
View File
@@ -0,0 +1,65 @@
---
title: web demo
> ext/web/web.mq.md
---
# main
> web.ensure_plugin
`nav` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| 首页 | / | |
| 管理 | /admin | |
`side` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| 全部文章 | / | |
| 管理后台 | /admin | |
`foot` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| Marqdo | https://github.com/cflmy/marqdo | |
`articles` =
| 字段 | 类型 | 可空 |
|------|------|------|
| id | integer | false |
| title | text | false |
| body | text | true |
`主体` =
| 前端变量 | 后端数据库 | 绑定css样式 |
|----------|------------|-------------|
| title | title | card-title |
| body | body | card-body |
`种子` =
| @ | title | body |
|---|-------|------|
| 1 | hello | first-row |
| 2 | second | card-body |
*`db` = > web.db url="sqlite:./data/web-demo.db" *
*`articles` = > `db`.init name=articles fields=`articles` *
> `db`.insert table=`articles` rows=`种子`
*`page` = > web.page title=Demo *
*`page` = > `page`.nav table=`nav` *
*`page` = > `page`.sidebar table=`side` *
*`page` = > `page`.footer table=`foot` *
*`page` = > `page`.main table=`articles` bind=`主体` layout=cards intro="<h1>Marqdo Web</h1><p>变量名即表名:articles;页面先创建再挂 nav / main。</p>" *
*`app` = > web.app page=`page` db=`db` admin=True host=127.0.0.1 port=18080 *
> `app`.static dir=ext/web/templates/starter/static
> print text=listening
> `app`.listen