@qilitt-mickey/vue3-temp-skill 1.1.14 → 1.1.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +3 -2
- package/package.json +1 -1
- package/references/code-quality.md +8 -4
- package/references/core-kernel.md +15 -16
- package/references/crud-pages.md +41 -11
- package/references/design-handoff.md +255 -30
- package/references/design-system.md +73 -29
- package/references/directives-advanced.md +1 -1
- package/references/feedback-loading.md +16 -0
- package/references/flowchart-g6.md +1 -2
- package/references/form-advanced.md +3 -2
- package/references/graph-relation.md +2 -2
- package/references/layout-theme.md +89 -48
- package/references/project-inventory.md +48 -46
- package/references/ui-components.md +43 -141
package/SKILL.md
CHANGED
|
@@ -13,6 +13,7 @@ tags: [vue3, typescript, element-plus, vant, pinia, vite, unocss, crud, componen
|
|
|
13
13
|
|
|
14
14
|
- 面向由 **vue3-web-temp** 脚手架搭出的业务项目(目录名/安装路径因人而异,以当前工作区为准)
|
|
15
15
|
- 业务写法以本包 `references/` 为准;壳层行为(顶部 tag / 侧栏 / keep-alive / `useDetail`)以**当前项目**已有实现为准
|
|
16
|
+
- **双轨**:无设计 handoff → 保持模版出厂令牌;有设计落地 → 读 `design-handoff.md`,按设计规范回填令牌(视觉关键尺寸须为 CSS 变量)
|
|
16
17
|
|
|
17
18
|
## 使用方式
|
|
18
19
|
|
|
@@ -52,7 +53,7 @@ tags: [vue3, typescript, element-plus, vant, pinia, vite, unocss, crud, componen
|
|
|
52
53
|
|------|------|
|
|
53
54
|
| addon / 查 Re* 名 / 装依赖 | `references/project-inventory.md` |
|
|
54
55
|
| 写完代码后(闸门,非功能命中) | `references/code-quality.md` |
|
|
55
|
-
| 设计交接块 / 上游令牌产出落地 | `references/design-handoff.md`(+ `design-system`) |
|
|
56
|
+
| 设计交接块 / **design-handoff/v1 JSON** / 上游令牌产出落地 | `references/design-handoff.md`(+ `design-system`) |
|
|
56
57
|
|
|
57
58
|
### 标准业务面
|
|
58
59
|
|
|
@@ -69,7 +70,7 @@ tags: [vue3, typescript, element-plus, vant, pinia, vite, unocss, crud, componen
|
|
|
69
70
|
| **feedback-loading** | message、loading、确认框 |
|
|
70
71
|
| **base-code-dict** | 字典、baseCode、码表 |
|
|
71
72
|
| **api-check** | 联调、mock、契约、对接后端 |
|
|
72
|
-
| **ui-components** | Re
|
|
73
|
+
| **ui-components** | 新建 Re*、type.ts、组件目录;**用法见各功能模块**(本文件仅索引) |
|
|
73
74
|
|
|
74
75
|
### 专项能力包
|
|
75
76
|
|
package/package.json
CHANGED
|
@@ -37,13 +37,14 @@ lint / type-check **过了也不能放过**下列项。发现即改代码,禁
|
|
|
37
37
|
| `toDetail` / 独立 `*Detail` 路由 | 路由无 `activePath`,或 `showLink` 非 `false` | `detail-page` 三件套 |
|
|
38
38
|
| 同上 | 默认场景缺 `keepAlive`/`moreTags`(业务未声明不要缓存) | 样板默认写出;不要缓存再删 |
|
|
39
39
|
| 同上 | 详情页无 `initToDetail`,或 `name` 与路由不一致 | 对齐 `defineOptions` |
|
|
40
|
-
| 列表页 | 无 `el-card.vts-page-card` / 无 `tableHeight` / 分页在 ReTableBar 外 | `crud-pages` L1–
|
|
40
|
+
| 列表页 | 无 `el-card.vts-page-card` / `100vh` 减顶栏定高 / 无 `tableHeight` / 分页在 ReTableBar 外 / 操作列手写多按钮未用 `ReTableOperate` | `crud-pages` L1–L9 |
|
|
41
41
|
| `src/api/**` | 绕过 `@/utils/http`,或虚构 `/api` 前缀,或响应当 `success`/`code` | `http-api` |
|
|
42
42
|
| 下载/导出 API | 无 `responseType: "blob"` | `http-api` / `download-export` |
|
|
43
43
|
| 删除/危险操作 | 无确认框 | `feedback-loading` |
|
|
44
44
|
| 编辑回显 | 整表 `formData = res.data` 破坏响应式 | `Object.assign`(`data-writeback`) |
|
|
45
45
|
| 按钮权限需求 | 裸 `v-if` 角色判断,未用 `v-auth`/`ReAuth` | `permission-auth` |
|
|
46
46
|
| 新菜单路由 | 父级无 `icon` 或业务页二次挂 `Layout` | `icons` + `core-kernel` |
|
|
47
|
+
| 列表查询区 `el-form` / 查询按钮 | 写了 `size="small"`(紧凑主题用户未要求) | 不写 size,用 default=`--control-height` |
|
|
47
48
|
|
|
48
49
|
## 选型与硬约束
|
|
49
50
|
|
|
@@ -53,7 +54,8 @@ lint / type-check **过了也不能放过**下列项。发现即改代码,禁
|
|
|
53
54
|
- [ ] 列表方法名 `onSearch` / `reset`;HTTP 用 `@/utils/http` + `Result<T>`
|
|
54
55
|
- [ ] 业务路由未二次挂 Layout
|
|
55
56
|
- [ ] 独立详情:对照路由文件确认 `showLink:false` + `activePath` + `keepAlive`/`moreTags`(默认)+ `toDetail` + `initToDetail`
|
|
56
|
-
- [ ] 列表布局按 `crud-pages` 黄金样板(`el-card.vts-page-card`+`content
|
|
57
|
+
- [ ] 列表布局按 `crud-pages` 黄金样板(`el-card.vts-page-card`+`content`、无 `100vh` 减顶栏、`tableHeight`、`otherRef`、分页在 ReTableBar 内;内容区无外层滚动条)
|
|
58
|
+
- [ ] 顶栏高度仅 `--header-height` 等 CSS 令牌;禁止 JS 测顶栏 / `platform-config` 顶栏像素字段 / `useApp` 导出顶栏高度
|
|
57
59
|
|
|
58
60
|
## TypeScript
|
|
59
61
|
|
|
@@ -91,7 +93,7 @@ lint / type-check **过了也不能放过**下列项。发现即改代码,禁
|
|
|
91
93
|
## 样式
|
|
92
94
|
|
|
93
95
|
- [ ] `scoped`;色用 CSS 变量;优先 UnoCSS 连字符类(`p-5` 非 `p5`)
|
|
94
|
-
- [ ] 语义色 `bg-bg_color` / `--el-*`;尺寸档位见 `core-kernel`
|
|
96
|
+
- [ ] 语义色 `bg-bg_color` / `--el-*`;尺寸档位见 `core-kernel` 样式契约(查询区 default 32,禁止误用 small 24)
|
|
95
97
|
- [ ] 图标见 `icons`;忌滥 `!important`;选择器 ≤3 层
|
|
96
98
|
- [ ] 全局 EP 覆盖在 `element-plus.scss`;侧栏色用 `html[data-theme]`
|
|
97
99
|
- [ ] 主色经 `setEpThemeColor()`;颜色处理用 `chroma-js`
|
|
@@ -101,7 +103,9 @@ lint / type-check **过了也不能放过**下列项。发现即改代码,禁
|
|
|
101
103
|
- [ ] 规范识别回执;令牌 / `platform-config.json` / 侧栏主题一致
|
|
102
104
|
- [ ] 已建 `design-tokens.scss`;`index.scss` 中其 `@use` 最前
|
|
103
105
|
- [ ] 冲突清单已逐条处理(见 `design-system`)
|
|
104
|
-
- [ ] 有上游设计产出时已读 `design-handoff
|
|
106
|
+
- [ ] 有上游设计产出时已读 `design-handoff`:JSON 优先;按**全量令牌核对表 A~E**回填或回执「保留出厂」;`ShowModel` 写 JSON 值(设计默认常 `line`);错误色 `#F5222D`;弹窗/壳层改令牌即生效
|
|
107
|
+
- [ ] **无**设计落地时未改出厂主色 / ShowModel / 壳层 / 弹窗几何默认
|
|
108
|
+
- [ ] 组件尺寸三档已落地并桥接 `--el-component-size*`;缺档落到 default;未全局强制 `size="small"`;**查询区不写 size**(三档对照表 ≠ 查询区要用 small)
|
|
105
109
|
|
|
106
110
|
## 业务
|
|
107
111
|
|
|
@@ -24,7 +24,7 @@ tags: [vue3, kernel, conventions, layout, router, http, crud, inventory]
|
|
|
24
24
|
| 9 | i18n:`$t('中文key')` |
|
|
25
25
|
| 10 | 禁止用 `v-html` 渲染不可信内容 |
|
|
26
26
|
| 11 | 新依赖须用户确认;已有封装须复用;选型表指定库勿擅自替换 |
|
|
27
|
-
| 12 | 列表布局按 **`crud-pages` 黄金样板**(`el-card.vts-page-card`+`content
|
|
27
|
+
| 12 | 列表布局按 **`crud-pages` 黄金样板**(`el-card.vts-page-card`+`content`、无 `100vh` 减顶栏定高、`tableHeight`、`otherRef`、分页在 ReTableBar 内;仅表格体内滚动) |
|
|
28
28
|
| 13 | addon 按 `project-inventory` 第九节精确版本安装;禁止 `@latest` |
|
|
29
29
|
| 14 | 样式契约见下文「样式契约」 |
|
|
30
30
|
|
|
@@ -82,7 +82,7 @@ export function getCustomerList(data: CustomerQuery, url: string) {
|
|
|
82
82
|
|
|
83
83
|
| Hook | 用途 | 详例 |
|
|
84
84
|
|------|------|------|
|
|
85
|
-
| `useApp` |
|
|
85
|
+
| `useApp` | 字典、svgLoading | — |
|
|
86
86
|
| `useTableSearch` | 列表查询分页 | `crud-pages` |
|
|
87
87
|
| `useDetail` | 详情跳转与顶部 tag | `detail-page` |
|
|
88
88
|
| `useFormCheck` | 多表单校验 | `data-writeback` |
|
|
@@ -111,28 +111,27 @@ export function getCustomerList(data: CustomerQuery, url: string) {
|
|
|
111
111
|
|
|
112
112
|
### 组件尺寸
|
|
113
113
|
|
|
114
|
-
| 场景 | 档位 |
|
|
115
|
-
|
|
116
|
-
|
|
|
117
|
-
| 表格 / 分页 | `:size="size"`(ReTableBar 透出) |
|
|
118
|
-
|
|
|
119
|
-
|
|
|
120
|
-
| 移动端 Vant | 见 `mobile-h5` |
|
|
114
|
+
| 场景 | 档位 | 像素(令牌) |
|
|
115
|
+
|------|------|--------------|
|
|
116
|
+
| 查询区表单/按钮、工具栏按钮、弹窗内表单 | **default(不写 size)** | `--control-height`(设计 `--component-size-base`,默认 32px) |
|
|
117
|
+
| 表格 / 分页 | `:size="size"`(ReTableBar 透出) | 随密度切换,与表单档位独立 |
|
|
118
|
+
| 表格行内操作、紧凑工具条 | `small` | `--control-height-sm`(24px) |
|
|
119
|
+
| 登录/整屏主表单主按钮 | `large` | `--control-height-lg`(40px) |
|
|
120
|
+
| 移动端 Vant | 见 `mobile-h5` | — |
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
- **禁止**查询区 / 标准业务表单写 `size="small"`,也**禁止** `el-config-provider` 全局强制 `small`(除非用户明确要求紧凑主题)。
|
|
123
|
+
- 存在 `design-tokens.scss` 时:零新增硬编码裸值;三档桥接与 EP 映射见 `design-system` 7.5.8。
|
|
124
|
+
- 适配流程见 `design-system`。
|
|
123
125
|
|
|
124
126
|
### 独立功能页容器
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
定高且内部滚动(与列表卡同类场景)——优先 `el-card.vts-page-card`;非 Card 根节点用 `vts-page-fill`:
|
|
127
129
|
|
|
128
130
|
```vue
|
|
129
|
-
<div
|
|
130
|
-
:style="{ height: `calc(100vh - 2 * var(--vts-margin) - ${headerHeight}px)` }"
|
|
131
|
-
class="pos-relative bg-bg_color p-5 overflow-hidden"
|
|
132
|
-
>
|
|
131
|
+
<div class="vts-page-fill h-full pos-relative bg-bg_color p-5 overflow-hidden">
|
|
133
132
|
```
|
|
134
133
|
|
|
135
|
-
查询列表定高卡 → `crud-pages`(`el-card.vts-page-card` + `tableHeight
|
|
134
|
+
查询列表定高卡 → `crud-pages`(`el-card.vts-page-card` + `tableHeight`,禁止 `100vh` 减顶栏定高)。
|
|
136
135
|
## 六、资产分层
|
|
137
136
|
|
|
138
137
|
附加 Hook/组件按功能模块加载(WebSocket、微信、附件、图表等)→ 见各专项与 `project-inventory`。
|
package/references/crud-pages.md
CHANGED
|
@@ -29,23 +29,27 @@ useTableSearch(formQuery, searchFn, url)
|
|
|
29
29
|
|
|
30
30
|
| 场景 | 做法 |
|
|
31
31
|
|------|------|
|
|
32
|
-
| 查询列表(定高) | `el-card.vts-page-card
|
|
32
|
+
| 查询列表(定高) | `el-card.vts-page-card`(禁止 `100vh` 减顶栏定高);表格绑 `tableHeight`;仅表格体内滚动;分页在表格下方;整页无外层滚动条 |
|
|
33
33
|
| 树 + 表分栏 | 同上;左侧树、右侧表共用定高卡,高度仍走 `useTableSearch` 几何实测 |
|
|
34
|
-
| 长表单 / 详情 / 说明类 |
|
|
35
|
-
| Card
|
|
34
|
+
| 长表单 / 详情 / 说明类 | 根节点 `min-height: 100%`(或 `:style="{ minHeight: '100%' }"`);超出由 `.app-main` 内 `el-scrollbar` 滚动 |
|
|
35
|
+
| 非 Card 整页填满 | 根节点加 `class="vts-page-fill"` + `height: 100%` / `h-full` |
|
|
36
|
+
| Card 内边距 | 一律走 `--vts-card-padding`(桥接 `--card-padding`);换规范 / `--vts-margin` 变化由壳层 flex 链 + Hook 自动跟随 |
|
|
37
|
+
|
|
38
|
+
> **壳层原理**(`lay-content`):`.main-content` 用 `padding: var(--vts-margin)`(不用 margin);定高页 `.main-content:has(.vts-page-card)` / `.vts-page-fill` 为 `height: 100%`;`.vts-page-card` 填满。`html/body/#app/.app-wrapper/.main-container/.app-main` 均为 `height:100%; overflow:hidden`。禁止业务页 `100vh` 减顶栏定高。
|
|
36
39
|
|
|
37
40
|
## 列表黄金样板(唯一完整示例)
|
|
38
41
|
|
|
39
42
|
| # | 必须 |
|
|
40
43
|
|---|------|
|
|
41
44
|
| L1 | `el-card` + `class="vts-page-card"` + `ref="content"`(禁止挂 `div`) |
|
|
42
|
-
| L2 |
|
|
45
|
+
| L2 | 不要写 `height: calc(100vh - …)` / 不要用 JS 测顶栏定高(壳层 + `.vts-page-card` 已填满) |
|
|
43
46
|
| L3 | 查询区 `bg-bg_color p-5`;展示区 `ReTableBar class="bg-bg_color"` |
|
|
44
47
|
| L4 | `ReGrid` `:gap="[0,20]"` + cols;表单项 `w-[100%] !mr-0`;`@should-show-collapse` |
|
|
45
|
-
| L5 |
|
|
48
|
+
| L5 | 查询区 `<ReGridItem suffix>`(查询 / 重置 / 展开收起) |
|
|
46
49
|
| L6 | 表格绑 `ref="multipleTableRef"` + `tableHeight`;分页在 `ReTableBar` `#default` 内、表格下方 |
|
|
47
50
|
| L7 | `RePagination`:`:pagination` + `@handle-current-change` / `@handle-size-change` |
|
|
48
51
|
| L8 | 查询与表之间的额外模块包一根元素绑 `otherRef`(须在表格上方,高度计入 `tableTop`) |
|
|
52
|
+
| L9 | 表格操作列 `ReTableOperate :list`;按钮过多用 `limit`(默认 **3**)自动「更多」下拉,见下文专节 |
|
|
49
53
|
|
|
50
54
|
```vue
|
|
51
55
|
<script setup lang="ts">
|
|
@@ -63,7 +67,7 @@ import { message } from "@/utils/message";
|
|
|
63
67
|
|
|
64
68
|
defineOptions({ name: "CustomerList" });
|
|
65
69
|
|
|
66
|
-
const {
|
|
70
|
+
const { svgLoading } = useApp();
|
|
67
71
|
const formQuery = reactive<CustomerQuery>({ keyword: "", status: undefined });
|
|
68
72
|
|
|
69
73
|
const {
|
|
@@ -125,9 +129,6 @@ function handleSizeChange(size: number) {
|
|
|
125
129
|
ref="content"
|
|
126
130
|
class="vts-page-card"
|
|
127
131
|
shadow="never"
|
|
128
|
-
:style="{
|
|
129
|
-
height: `calc(100vh - 2 * var(--vts-margin) - ${headerHeight}px)`,
|
|
130
|
-
}"
|
|
131
132
|
>
|
|
132
133
|
<div>
|
|
133
134
|
<el-form
|
|
@@ -236,7 +237,35 @@ function handleSizeChange(size: number) {
|
|
|
236
237
|
</template>
|
|
237
238
|
```
|
|
238
239
|
|
|
239
|
-
补充:`ReTableOperate` 用 `:list`;`defineOptions.name` === 路由 `name`;`
|
|
240
|
+
补充:`ReTableOperate` 用 `:list`;`defineOptions.name` === 路由 `name`;`svgLoading` 来自 `useApp()`;列表定高走壳层令牌 + `vts-page-card`。
|
|
241
|
+
|
|
242
|
+
## 操作列按钮过多(ReTableOperate · 强制)
|
|
243
|
+
|
|
244
|
+
落点:`src/components/ReTableOperate`。列表行操作**必须**用本组件,禁止手写一排 `el-button` / 自造「更多」菜单。
|
|
245
|
+
|
|
246
|
+
### 行为(与模版一致)
|
|
247
|
+
|
|
248
|
+
| 项 | 约定 |
|
|
249
|
+
|----|------|
|
|
250
|
+
| `limit` | 默认 **`3`**:可见按钮总数阈值(含「更多」槽位) |
|
|
251
|
+
| ≤ `limit` | 全部以文字按钮平铺 |
|
|
252
|
+
| > `limit` | 前 **`limit - 1`** 个平铺,其余进 **「更多」** `el-dropdown` |
|
|
253
|
+
| 过滤顺序 | 先 `auth`(`hasAuth`)→ 再 `show(row)` → 再按 `limit` 折叠 |
|
|
254
|
+
| `size` | 组件默认 `small`(行内紧凑);可按列改 |
|
|
255
|
+
|
|
256
|
+
示例:`limit=3` 且有 5 个可见按钮 → 平铺 2 个 +「更多」(内含后 3 个)。
|
|
257
|
+
|
|
258
|
+
```vue
|
|
259
|
+
<!-- 默认折叠阈值 3 -->
|
|
260
|
+
<ReTableOperate :list="operateButtons" :row="row" :index="$index" />
|
|
261
|
+
|
|
262
|
+
<!-- 需要多露几个时再改,勿低于 2(否则「更多」几乎占满) -->
|
|
263
|
+
<ReTableOperate :list="operateButtons" :row="row" :index="$index" :limit="4" />
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
`OperateButton` 常用字段:`label`、`type`、`icon`、`auth`、`show`、`disabled`、`onClick`(见组件 `type.ts`)。危险操作用 `type: 'danger'`;权限写 `auth`,勿在列模板里 `v-if` 角色。
|
|
267
|
+
|
|
268
|
+
操作列 `width`:按钮多时适当加宽(如 160~220),仍依赖 `limit` 折叠,禁止无限加宽硬塞。
|
|
240
269
|
|
|
241
270
|
## 列表 → 详情/编辑
|
|
242
271
|
|
|
@@ -343,10 +372,11 @@ async function onSubmit() {
|
|
|
343
372
|
| 错误 | 正确 |
|
|
344
373
|
|------|------|
|
|
345
374
|
| `handleSearch` / 手写分页 | `onSearch` / `useTableSearch` |
|
|
346
|
-
| `ref="content"` 挂 div /
|
|
375
|
+
| `ref="content"` 挂 div / `100vh` 减顶栏定高 / 缺 `vts-page-card` | `el-card.vts-page-card`(高度交给壳层) |
|
|
347
376
|
| 不绑 `tableHeight` / 分页在卡片外 / 手写魔法数扣高度 | 样板 L6/L7;高度交给 `useTableSearch` |
|
|
348
377
|
| 额外模块不绑 `otherRef` | L8 |
|
|
349
378
|
| 只写 `toDetail`、详情路由缺 `activePath` | 三件套整段落盘(见 detail-page) |
|
|
350
379
|
| 裸 `router.push` 开详情 | `toDetail` + meta(见 detail-page) |
|
|
351
380
|
| `ReTableOperate :buttons` | `:list` |
|
|
381
|
+
| 操作列手写多颗 `el-button` / 自造更多菜单 | `ReTableOperate`;过多靠 `limit`(默认 3)进「更多」 |
|
|
352
382
|
| `@show-collapse` | `@should-show-collapse` |
|
|
@@ -1,32 +1,142 @@
|
|
|
1
1
|
---
|
|
2
2
|
skill: design-handoff
|
|
3
|
-
description: 设计产出物 →
|
|
3
|
+
description: 设计产出物 → 业务项目样式落地。优先认 design-handoff/v1 JSON;兼容旧交接块与令牌 CSS。
|
|
4
4
|
scope: project
|
|
5
|
-
tags: [handoff, design-tokens, upstream, artifacts]
|
|
5
|
+
tags: [handoff, design-tokens, upstream, artifacts, json]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 设计产出 → 模板落地
|
|
9
9
|
|
|
10
|
+
## 双轨(必读)
|
|
11
|
+
|
|
12
|
+
| 场景 | 行为 |
|
|
13
|
+
|------|------|
|
|
14
|
+
| **未调用设计 / 无 handoff** | 保持模版出厂令牌与 `platform-config`(主色 `#409EFF`、壳 64/208/40、margin 8、`ShowModel: chrome` 等)。**禁止**为「看起来像设计」而改出厂 |
|
|
15
|
+
| **有 design-handoff/v1 或用户要求按设计落地** | 以**设计规范**为准全量回填 `design-tokens` + 配置;设计 JSON/规范未给出的字段**保留出厂**;代码层须已消费 `var(--token)`,改令牌即全局生效 |
|
|
16
|
+
|
|
17
|
+
跨编辑器一致:设计侧 `handoff-output.md`(**JSON 字段形状**)+ 本文件(**→ 模版映射**)+ 模版 `design-tokens.scss` 注释对齐。
|
|
18
|
+
**分工**:设计师只改视觉规范正文,不维护本映射表;规范装进不了现有 JSON 时,由研发扩 `handoff-output` Schema 并同步改本文件。禁止只改文档不改令牌、或只改裸 px 不改令牌。
|
|
19
|
+
|
|
10
20
|
## 触发
|
|
11
21
|
|
|
12
22
|
出现以下任一情况时执行本协议(与业务开发的先后跟用户需求:可先定风格再写业务,也可在已有业务上全量重构样式):
|
|
13
23
|
|
|
14
|
-
-
|
|
24
|
+
- 会话 / 附件 / 仓库中有 **`design-handoff/v1` JSON**(优先)
|
|
25
|
+
- 会话有「前端落地交接」块 / `【主题色系】` / `:root` 令牌 CSS(兼容)
|
|
15
26
|
- 用户要求按设计稿 / 规范适配或重构整站风格
|
|
16
27
|
- 用户附带色板、规范或 HTML 原型
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
动手改文件前先输出**规范识别回执**(见下文)。
|
|
30
|
+
|
|
31
|
+
## 收集产出(优先级)
|
|
19
32
|
|
|
20
33
|
| 优先 | 形态 | 用途 |
|
|
21
34
|
|------|------|------|
|
|
22
|
-
| 1 |
|
|
23
|
-
| 2 |
|
|
24
|
-
| 3 |
|
|
25
|
-
| 4 |
|
|
26
|
-
| 5 |
|
|
35
|
+
| **1** | **`design-handoff/v1` JSON** | 结构化写入 tokens / 几何 / `ShowModel`(**首选**) |
|
|
36
|
+
| 2 | 前端落地交接块 | `data-theme` / 侧栏 / DarkMode / 主色 |
|
|
37
|
+
| 3 | 令牌 CSS(`--brand-*` / `--primary-*` 等) | 写入 `design-tokens.scss` |
|
|
38
|
+
| 4 | 几何/间距数值 | 覆盖桥接令牌;缺则保留模版默认 |
|
|
39
|
+
| 5 | HTML/CSS 原型 | 微调 `element-plus.scss` |
|
|
40
|
+
| 6 | 项目已有 `design-tokens.scss` | 读现状 |
|
|
41
|
+
|
|
42
|
+
定位 JSON:
|
|
43
|
+
|
|
44
|
+
1. 会话中的 ` ```json ` 且含 `"$schema": "design-handoff/v1"`
|
|
45
|
+
2. 仓库 `design/design-handoff.json`(或用户指定路径)
|
|
46
|
+
3. 附件同名文件
|
|
47
|
+
|
|
48
|
+
有 JSON 时:**以 JSON 为准**;交接块 / 零散 CSS 仅补 JSON 未覆盖字段。
|
|
49
|
+
无 JSON 时:回退优先 2~5(旧协议),并在回执中注明「建议补齐 design-handoff/v1」。
|
|
50
|
+
|
|
51
|
+
缺主色阶 →「待确认」;有 `brandPrimary` 则可先落主色与壳桥接,不臆造 `primaryScale`。
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## JSON → 模版映射(`design-handoff/v1`)
|
|
56
|
+
|
|
57
|
+
设计侧 schema 见上游 `handoff-output.md`(字段名以下表为准)。
|
|
58
|
+
|
|
59
|
+
### `meta` / `shell` → 配置
|
|
60
|
+
|
|
61
|
+
| JSON 字段 | 落点 | 写入 |
|
|
62
|
+
|-----------|------|------|
|
|
63
|
+
| `tokens.brandPrimary` | `platform-config.json` → `EpThemeColor` | HEX;并 bump `Version` |
|
|
64
|
+
| `shell.darkMode` | `platform-config.json` → `DarkMode` | boolean |
|
|
65
|
+
| `shell.sidebar` | `platform-config.json` → `Theme` + 侧栏令牌 | `dark-gradient` → 深色侧栏主题(如 `default`)+ 写入 `--sidebar-*`;`light` → 浅色侧栏,勿套深色渐变 |
|
|
66
|
+
| `shell.dataTheme` | `html[data-theme]` / 配置 | 有则用;无则按 sidebar/contentMode 推断,写回执 |
|
|
67
|
+
| `shell.contentMode` | 内容区默认亮暗 | 与 DarkMode / 用户确认对齐 |
|
|
68
|
+
| `shell.showModel` | `platform-config.json` → **`ShowModel`** | **以 JSON 为准**写入(设计当前默认 **`line`**;旧稿可能为 `card`) |
|
|
69
|
+
| `shell.contentMargin` | `--layout-content-padding`(及桥接 `--vts-margin`) | 数字 px,如 `24`(模版出厂常为 **8**;**有 handoff 才覆盖**) |
|
|
70
|
+
|
|
71
|
+
写入 `ShowModel` 后同步 `$storage.configure.showModel`(或 bump `Version` 清缓存)。
|
|
72
|
+
- **`card`**:写 `--vts-tag-card-*`(见 geometry)
|
|
73
|
+
- **`line`**:无容器文字页签(见 `notes` / `homeTabSize` / `tagDividerWidth`);模版若尚未实现该枚举 → 回执「待实现 line」,**禁止**静默改成 `card`;可先落令牌与配置,页签样式单开任务
|
|
74
|
+
- **`chrome` / `smart`**:仅当 JSON 明确要求时写入
|
|
75
|
+
|
|
76
|
+
### `geometry` → 令牌
|
|
77
|
+
|
|
78
|
+
| JSON 字段 | CSS 变量(`design-tokens.scss` / 桥接) |
|
|
79
|
+
|-----------|----------------------------------------|
|
|
80
|
+
| `headerHeight`(JSON geometry) | `--header-height` / `--layout-header-height` |
|
|
81
|
+
| `tabsHeight` | `--tabs-height`(壳层多标签栏;**不是** `--tabs-item-height`) |
|
|
82
|
+
| `siderWidth` | `--sidebar-width` / `--layout-sider-width` |
|
|
83
|
+
| `siderCollapsedWidth` | `--sidebar-collapsed-width` / `--layout-sider-collapsed-width` |
|
|
84
|
+
| `contentPadding` / `shell.contentMargin` | `--layout-content-padding` → `--vts-margin`(不一致时以 `contentMargin` 为准并回执) |
|
|
85
|
+
| `tagCardHeight` | `--vts-tag-card-height`(`showModel=card`) |
|
|
86
|
+
| `tagCardRadius` | `--vts-tag-card-radius`(`showModel=card`) |
|
|
87
|
+
| `tagCardGap` | `--vts-tag-card-gap`(`showModel=card`) |
|
|
88
|
+
| `homeTabSize` | 首页纯图标页签边长(`showModel=line`,常见 40) |
|
|
89
|
+
| `tagDividerWidth` | 页签间竖分割线宽(`showModel=line`,常见 1) |
|
|
27
90
|
|
|
28
|
-
|
|
29
|
-
|
|
91
|
+
可选(设计组件规范提及或 handoff.notes 给出时写入):
|
|
92
|
+
|
|
93
|
+
| 语义 | CSS 变量 | 出厂参考 |
|
|
94
|
+
|------|----------|----------|
|
|
95
|
+
| EP 内容 Tabs 项高 | `--tabs-item-height` | 46 |
|
|
96
|
+
| 弹窗头/底高 | `--dialog-header-height` / `--dialog-footer-height` | 38 |
|
|
97
|
+
| 弹窗 body 内边距 | `--dialog-body-padding` | 15 |
|
|
98
|
+
| 弹窗圆角 | `--dialog-border-radius` | 10(设计落地可改 `--radius-lg`) |
|
|
99
|
+
| 按钮水平 padding | `--button-padding-x` | 15 |
|
|
100
|
+
| Switch | `--switch-min-width` / `--switch-height` / `--switch-border-radius` | 36 / 20 / 10 |
|
|
101
|
+
| 页脚高 | `--layout-footer-height` | 48 |
|
|
102
|
+
|
|
103
|
+
改几何后:**不要**让业务页重写 `100vh`;定高列表走 `%` / flex(`vts-page-card`)。
|
|
104
|
+
|
|
105
|
+
**硬要求**:落地前 grep `src/layout`、`ReDialog`、`element-plus.scss` 壳层几何,确认消费的是 `var(--…)`;若仍有不可覆盖裸 px,**先改代码再写令牌**。
|
|
106
|
+
|
|
107
|
+
### `tokens` → `design-tokens.scss`
|
|
108
|
+
|
|
109
|
+
| JSON 字段 | CSS 变量 |
|
|
110
|
+
|-----------|----------|
|
|
111
|
+
| `brandPrimary` | `--brand-primary`;`--primary-5` / `--primary-color`;`--el-color-primary` 桥接保持 `var(--brand-primary)` |
|
|
112
|
+
| `brandHover` | `--brand-hover` |
|
|
113
|
+
| `brandActive` | `--brand-active` |
|
|
114
|
+
| `primaryScale[0..9]` | `--primary-0` … `--primary-9`;并设 `--primary-hover` = scale[6],`--primary-active` = scale[7],`--primary-bg` = scale[0](或设计指定),`--primary-bg-hover` = scale[1] |
|
|
115
|
+
| `success` | `--success-color` |
|
|
116
|
+
| `warning` | `--warning-color` |
|
|
117
|
+
| `error` | `--error-color` 与 **`--error-6`**(同值) |
|
|
118
|
+
| `errorBg` | `--error-bg`(有则写) |
|
|
119
|
+
| `layoutBg` | `--layout-bg` |
|
|
120
|
+
| `componentBg` | `--component-bg` |
|
|
121
|
+
|
|
122
|
+
校验:`primaryScale.length === 10` 且 `primaryScale[5] === brandPrimary`;否则回执「待确认」并先写 brand,不瞎补色阶。
|
|
123
|
+
|
|
124
|
+
### `componentSize` → 控件高度
|
|
125
|
+
|
|
126
|
+
| JSON | 令牌 |
|
|
127
|
+
|------|------|
|
|
128
|
+
| `sm` | `--control-height-sm` / `--component-size-sm` / `--el-component-size-small` |
|
|
129
|
+
| `base` | `--control-height` / `--component-size-base` / `--el-component-size` |
|
|
130
|
+
| `lg` | `--control-height-lg` / `--component-size-lg` / `--el-component-size-large` |
|
|
131
|
+
|
|
132
|
+
细则见 `design-system` 7.5.8。缺档 → 落到 default(base),回执注明。
|
|
133
|
+
|
|
134
|
+
### 卡片页签关闭色(设计约束)
|
|
135
|
+
|
|
136
|
+
- 关闭 hover:圆形底 `--layout-bg`(=`tokens.layoutBg`)+ 图标 `--error-6` / `tokens.error`(`#F5222D`)
|
|
137
|
+
- **禁止**用 Element Plus 默认 danger `#F56C6C` 冒充错误色
|
|
138
|
+
|
|
139
|
+
---
|
|
30
140
|
|
|
31
141
|
## 覆盖清单
|
|
32
142
|
|
|
@@ -34,13 +144,25 @@ tags: [handoff, design-tokens, upstream, artifacts]
|
|
|
34
144
|
|---|------|------|
|
|
35
145
|
| A | `src/styles/design-tokens.scss` | 令牌 CSS;深色侧栏时追加 `--sidebar-*` |
|
|
36
146
|
| B | `theme.scss` 当前 `html[data-theme]` | `--vts-theme-*` → `--sidebar-*` |
|
|
37
|
-
| C | `public/platform-config.json` | `EpThemeColor` / `Theme` / `DarkMode
|
|
38
|
-
| D | `index.scss` | `design-tokens` 的 `@use`
|
|
39
|
-
| E | `dark.scss` / 语义色 | 跟 `--primary-*` |
|
|
147
|
+
| C | `public/platform-config.json` | `EpThemeColor` / `Theme` / `DarkMode` / **`ShowModel`**;`Version` 自增 |
|
|
148
|
+
| D | `index.scss` | `design-tokens` 的 `@use` 最前;按需 `--vts-margin` / `--vts-tag-card-*` |
|
|
149
|
+
| E | `dark.scss` / 语义色 | 跟 `--primary-*` / `--error-*` |
|
|
40
150
|
| F | 冲突清单 | `design-system` 第四节 |
|
|
41
151
|
| G | 规范识别回执 | 动手改文件前输出 |
|
|
152
|
+
| H | (可选)`design/design-handoff.json` | 若用户要求落盘,写入校验后的 JSON 副本 |
|
|
42
153
|
|
|
43
|
-
|
|
154
|
+
### 页签风格(ShowModel)
|
|
155
|
+
|
|
156
|
+
模版出厂常见:`smart` / `chrome` / `card`。设计 handoff 当前默认 **`line`**(无容器文字页签,见上游 `handoff-output.md`)。
|
|
157
|
+
|
|
158
|
+
| 场景 | `ShowModel` |
|
|
159
|
+
|------|-------------|
|
|
160
|
+
| 模版出厂、未落地设计 | 保持项目现有值,**勿强行改** |
|
|
161
|
+
| 设计 handoff 落地 | **写入 JSON 的 `shell.showModel`**(默认 `line`;旧 JSON 可能为 `card`) |
|
|
162
|
+
| JSON=`line` 且模版无实现 | 回执待实现;勿改写成 `card` |
|
|
163
|
+
| 用户在设置面板手动切换 | 以用户选择为准 |
|
|
164
|
+
|
|
165
|
+
侧栏派生(`shell.sidebar === "dark-gradient"` 时):
|
|
44
166
|
|
|
45
167
|
```scss
|
|
46
168
|
--sidebar-bg: linear-gradient(180deg, color-mix(in srgb, var(--primary-8) 88%, var(--primary-7)) 0%, var(--primary-9) 52%, color-mix(in srgb, var(--primary-9) 90%, #000) 100%);
|
|
@@ -57,27 +179,49 @@ tags: [handoff, design-tokens, upstream, artifacts]
|
|
|
57
179
|
|
|
58
180
|
`theme.scss`:`--vts-theme-menu-bg: var(--sidebar-bg);` 等 → `layout-theme`。
|
|
59
181
|
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## 规范识别回执(动手前必出)
|
|
185
|
+
|
|
186
|
+
```markdown
|
|
187
|
+
## 规范识别回执
|
|
188
|
+
- 来源形态:design-handoff/v1 JSON | 交接块 | 令牌 CSS | 混合
|
|
189
|
+
- 主题:{themeName} / {themeId} / 主色 {brandPrimary}
|
|
190
|
+
- ShowModel:{json.showModel,如 line/card}(将写入)| 保持现有 | line 待实现
|
|
191
|
+
- 几何:header {n} / tabs {n} / margin {n}
|
|
192
|
+
- 主色阶:完整 10 级 | 仅 brand(待确认色阶)
|
|
193
|
+
- 侧栏:dark-gradient | light
|
|
194
|
+
- 将改文件:design-tokens.scss / platform-config.json / index.scss / …
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
---
|
|
198
|
+
|
|
60
199
|
## 顺序
|
|
61
200
|
|
|
62
|
-
1.
|
|
201
|
+
1. 收集产出(JSON 优先)
|
|
63
202
|
2. 规范识别回执
|
|
64
|
-
3. A→E
|
|
65
|
-
4. F
|
|
66
|
-
5.
|
|
67
|
-
6.
|
|
203
|
+
3. A→E(按映射表写)
|
|
204
|
+
4. F 冲突核对
|
|
205
|
+
5. 验证侧栏 / 主色 / 页签(按 JSON `showModel`)/ 内容边距
|
|
206
|
+
6. 提醒清 `localStorage`(改了 `EpThemeColor` / `ShowModel` / `Version` 时)
|
|
207
|
+
7. 若同轮还有业务需求 → 再写/改 views(仅样式任务则到此结束)
|
|
68
208
|
|
|
69
|
-
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 兼容:旧交接块字段
|
|
212
|
+
|
|
213
|
+
无 JSON 时仍可认(可整块粘贴到会话):
|
|
70
214
|
|
|
71
|
-
```markdown
|
|
72
|
-
## 前端落地交接
|
|
73
215
|
- 设计来源:上游产出
|
|
74
|
-
-
|
|
75
|
-
- data-theme
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
216
|
+
- 主题色系:`<主题中文名>`
|
|
217
|
+
- data-theme:`<模版 html[data-theme] 值>`
|
|
218
|
+
- 侧栏:深色渐变 | 浅色
|
|
219
|
+
- 内容区默认:亮色 | 暗黑
|
|
220
|
+
- 主色:`#HEX`
|
|
221
|
+
- ShowModel:以设计为准(当前规范默认 `line`;旧稿 `card`)| `smart` | `chrome`(未落地设计时保留模版默认)
|
|
222
|
+
|
|
223
|
+
设计令牌 CSS 须含主色阶,并**建议含组件尺寸三档**:
|
|
79
224
|
|
|
80
|
-
## 设计令牌(CSS)
|
|
81
225
|
```css
|
|
82
226
|
:root {
|
|
83
227
|
--brand-primary: #...;
|
|
@@ -85,8 +229,89 @@ tags: [handoff, design-tokens, upstream, artifacts]
|
|
|
85
229
|
--brand-active: #...;
|
|
86
230
|
--primary-0: #...;
|
|
87
231
|
/* --primary-1 … --primary-9 */
|
|
232
|
+
--component-size-sm: 24px;
|
|
233
|
+
--component-size-base: 32px;
|
|
234
|
+
--component-size-lg: 40px;
|
|
88
235
|
}
|
|
89
236
|
```
|
|
90
|
-
|
|
237
|
+
|
|
238
|
+
| 档位 | 像素 | EP / 通用 API | 模版令牌 |
|
|
239
|
+
|------|------|---------------|----------|
|
|
240
|
+
| small | 24px | `size="small"` | `--control-height-sm` / `--el-component-size-small` |
|
|
241
|
+
| default | 32px | 不写 size | `--control-height` / `--el-component-size`【全站默认】 |
|
|
242
|
+
| large | 40px | `size="large"` | `--control-height-lg` / `--el-component-size-large` |
|
|
91
243
|
|
|
92
244
|
仅有交接块无令牌 CSS:写 `--brand-primary` + `EpThemeColor`,待确认注明缺色阶。
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## 设计落地 · 全量令牌核对表(强制)
|
|
249
|
+
|
|
250
|
+
> **出厂默认保留**;仅在有设计 handoff /「按设计规范适配」时执行。设计未给出的项勾「保留出厂」。漏项 = 硬失败风险。
|
|
251
|
+
|
|
252
|
+
### A. 壳层与页签
|
|
253
|
+
|
|
254
|
+
| 设计语义 | 写入令牌 | 缺省 |
|
|
255
|
+
|----------|----------|------|
|
|
256
|
+
| 顶栏高 | `--header-height` / `--layout-header-height` | 出厂 64 |
|
|
257
|
+
| 多标签栏高 | `--tabs-height` | 40 |
|
|
258
|
+
| 侧栏宽 / 收起 | `--sidebar-width` / `--sidebar-collapsed-width` | 208 / 64 |
|
|
259
|
+
| 内容区内边距 | `--layout-content-padding` → `--vts-margin` | 出厂 8;设计常 24 |
|
|
260
|
+
| 页脚高 | `--layout-footer-height` | 48 |
|
|
261
|
+
| 页签风格 | `ShowModel` = JSON `shell.showModel`(默认 `line`;`card` 时写 `--vts-tag-card-*`) | 未落地勿改 |
|
|
262
|
+
| 页签关闭/错误色 | `--error-color` / `--error-6`;`card` 时尚有 `--vts-tag-card-close-*` | `#F5222D` |
|
|
263
|
+
|
|
264
|
+
### B. 色板与文字
|
|
265
|
+
|
|
266
|
+
| 设计语义 | 写入令牌 | 缺省 |
|
|
267
|
+
|----------|----------|------|
|
|
268
|
+
| 主色 / hover / active | `--brand-*` + `EpThemeColor` | 出厂 `#409EFF` |
|
|
269
|
+
| 主色 10 阶 | `--primary-0`…`--primary-9`、`--primary-5` | 无阶则待确认,至少 `--primary-5=brand` |
|
|
270
|
+
| 成功/警告/错误 | `--success-color` / `--warning-color` / `--error-color` | 设计功能色 |
|
|
271
|
+
| 中性文字/边框/底 | `--text-*` / `--border-*` / `--layout-bg` / `--component-bg` | 出厂 |
|
|
272
|
+
| 弹窗渐变顶色 | `--primary-bg`、`--ds-dialog-bg` | 随 brand 浅混 |
|
|
273
|
+
|
|
274
|
+
### C. 控件与反馈几何
|
|
275
|
+
|
|
276
|
+
| 设计语义 | 写入令牌 | 缺省 |
|
|
277
|
+
|----------|----------|------|
|
|
278
|
+
| 控件三档 | `--control-height*` / `--component-size-*` / `--el-component-size*` | 24/32/40 |
|
|
279
|
+
| 按钮水平 padding | `--button-padding-x` | 15 |
|
|
280
|
+
| 圆角 | `--radius-sm/base/lg` | 4/6/8 |
|
|
281
|
+
| Card 内边距 | `--card-padding` / `--vts-card-padding` | 24 |
|
|
282
|
+
| Switch | `--switch-min-width/height/border-radius` | 出厂 36/20/10;设计若写 44×22 则覆盖 |
|
|
283
|
+
| Tag | `--tag-height` / `--tag-line-height` | 22/20 |
|
|
284
|
+
| EP 内容 Tabs 项高 | `--tabs-item-height` | 46(≠ 壳层 tabs) |
|
|
285
|
+
| 菜单项高 | `--el-menu-item-height` | 40 |
|
|
286
|
+
|
|
287
|
+
### D. 弹窗(出厂可保留;设计 Modal 规范出现则必须回填)
|
|
288
|
+
|
|
289
|
+
| 设计语义(component-spec Modal 等) | 写入令牌 | 出厂(未设计时) |
|
|
290
|
+
|----------|----------|------------------|
|
|
291
|
+
| 弹窗圆角(设计常 8) | `--dialog-border-radius` | 10 |
|
|
292
|
+
| 头/底高度或 padding | `--dialog-header-height` / `--dialog-footer-height` / padding 令牌 | 38 / 38 |
|
|
293
|
+
| 内容区内边距 | `--dialog-body-padding` | 15 |
|
|
294
|
+
| MessageBox 更紧凑 padding | `--message-box-*-padding` | 8×16 |
|
|
295
|
+
|
|
296
|
+
回填后确认 `ReDialog` / MessageBox 已 `var(--…)` 消费(改令牌即变,无需改业务页)。
|
|
297
|
+
|
|
298
|
+
### E. 落地后自检
|
|
299
|
+
|
|
300
|
+
- [ ] `platform-config`:`EpThemeColor` / `ShowModel` / `Theme` / `DarkMode` / `Version++`
|
|
301
|
+
- [ ] 侧栏深色渐变时 `--sidebar-*` + `theme.scss` 桥接
|
|
302
|
+
- [ ] grep 壳层与 ReDialog:无不可覆盖裸 px
|
|
303
|
+
- [ ] 列表页仍无 `100vh` 减顶栏;margin 变化后 flex 链正常
|
|
304
|
+
- [ ] 回执列出「已覆盖 / 保留出厂」字段清单
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 硬失败(code-quality 可引用)
|
|
309
|
+
|
|
310
|
+
| 条件 | 处理 |
|
|
311
|
+
|------|------|
|
|
312
|
+
| 用户要求按设计落地,但未写入 JSON 中的 `shell.showModel` | 硬失败:按 JSON 补写配置(默认常为 `line`) |
|
|
313
|
+
| JSON 有 `primaryScale` 但未写入 `--primary-0..9` | 硬失败 |
|
|
314
|
+
| 用 `#F56C6C` 或未映射的 EP danger 代替 `tokens.error` | 硬失败:改为 `#F5222D` / `--error-color` |
|
|
315
|
+
| 改了 `--layout-content-padding` / `--vts-margin` 后列表仍用 `100vh` 减顶栏定高 | 硬失败:迁 flex/`vts-page-card` |
|
|
316
|
+
| 设计落地后壳层/弹窗写死 px、改令牌不生效 | 硬失败:消费点改为 `var(--…)` 再回填 |
|
|
317
|
+
| 设计落地核对表(壳/色/控件/弹窗)有漏项且未标「保留出厂」 | 硬失败:补回填或回执注明 |
|