@qilitt-mickey/vue3-temp-skill 1.1.11 → 1.1.13
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/README.md +22 -63
- package/SKILL.md +114 -273
- package/package.json +1 -1
- package/references/api-check.md +33 -313
- package/references/code-quality.md +63 -277
- package/references/core-kernel.md +76 -396
- package/references/crud-pages.md +252 -93
- package/references/data-writeback.md +2 -2
- package/references/design-handoff.md +92 -0
- package/references/design-system.md +70 -60
- package/references/detail-page.md +55 -72
- package/references/form-advanced.md +1 -2
- package/references/layout-theme.md +103 -180
- package/references/mobile-h5.md +11 -11
- package/references/project-inventory.md +9 -10
- package/references/table-vxe.md +7 -13
- package/references/tree-table.md +2 -2
- package/references/websocket-realtime.md +3 -3
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
skill: design-system
|
|
3
|
-
description:
|
|
3
|
+
description: 设计规范识别与全量落地。命中「按 XX / UI 规范适配」时执行:识别回执 + design-tokens.scss + 几何并入 element-plus.scss + 冲突清单 + 公共区域。有上游设计产出时先走 design-handoff Step 0。
|
|
4
4
|
scope: project
|
|
5
5
|
tags: [design-system, design-tokens, antd, semi, arco, vuetify, findesign, element-plus, theme, css-variables]
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# 设计规范识别与全量适配机制
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
>
|
|
12
|
-
> **核心理念(始终明确)**:组件层永远是 **Element Plus**——代码照旧写 `<el-button>` / `<el-table>` / `<el-dialog>`,规范适配**不换组件**,只替换驱动组件样式的**“数据”**(令牌:高度/内边距/字号/圆角/颜色)。所有样式文件只是“按令牌数据执行”,换规范 = 换一套数据。
|
|
13
|
-
>
|
|
14
|
-
> **架构决策(单文件)**:适配只**新增一个文件** `design-tokens.scss`(纯数据层,无选择器);组件几何与视觉重写**直接并入模版既有的 `element-plus.scss` 等文件**(引用令牌 + 标注规范注释)。禁止另建并存的“重写层”文件——两个文件同时改 EP 组件样式会让后续开发者不知道改哪里、靠加载顺序压盖易失效。
|
|
15
|
-
|
|
16
|
-
### 职责分工(适配文件 vs 模版既有文件)
|
|
10
|
+
识别规范后,在业务项目完成:令牌层(数据)+ 模版样式改写(执行)+ 硬编码冲突清理。之后业务只引令牌,禁止裸值。组件层仍是 Element Plus(不换组件,只换令牌数据)。
|
|
17
11
|
|
|
18
|
-
| 文件 | 职责 |
|
|
19
|
-
|
|
20
|
-
| `design-tokens.scss`(**唯一新增**) |
|
|
21
|
-
| `element-plus.scss
|
|
22
|
-
| `reset.scss` / `index.scss
|
|
23
|
-
| `theme.scss` / `sidebar.scss
|
|
12
|
+
| 文件 | 职责 |
|
|
13
|
+
|------|------|
|
|
14
|
+
| `design-tokens.scss`(**唯一新增**) | 纯 `:root` 数据:主色/字体/圆角/高度 + 桥接 + `--el-*`;禁止选择器 |
|
|
15
|
+
| `element-plus.scss` | EP 几何/视觉唯一出口;全部 `var()` |
|
|
16
|
+
| `reset.scss` / `index.scss` | 基础与壳变量 |
|
|
17
|
+
| `theme.scss` / `sidebar.scss` | 侧栏/导航 |
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
禁止另建独立「重写层」文件。
|
|
26
20
|
|
|
27
21
|
---
|
|
28
22
|
|
|
@@ -32,7 +26,7 @@ tags: [design-system, design-tokens, antd, semi, arco, vuetify, findesign, eleme
|
|
|
32
26
|
|
|
33
27
|
- 用户提到内置预设之一:`Ant Design` / `antd` / 蚂蚁、`Semi Design` / 字节 Semi、`Arco Design`、`Vuetify` / Material、`FindDesign` / 京东 UDC / jdd-design;或提到**任意其他设计系统 / 自定义规范**(预设非封闭集,见 1.4)
|
|
34
28
|
- 用户说「按 XX 规范适配」「套设计规范」「UI 统一成 XX 风格」「重写组件样式以符合规范」
|
|
35
|
-
-
|
|
29
|
+
- 上游设计产出(令牌 / HTML 原型 / 规范文档 / 交接块)要求落到项目
|
|
36
30
|
|
|
37
31
|
### 1.2 识别表(内置预设 · 非封闭集)
|
|
38
32
|
|
|
@@ -79,6 +73,18 @@ tags: [design-system, design-tokens, antd, semi, arco, vuetify, findesign, eleme
|
|
|
79
73
|
|
|
80
74
|
## 二、强制适配工作流(按序执行,缺一不可)
|
|
81
75
|
|
|
76
|
+
### Step 0 上游设计产出落地(优先于 Step 1)
|
|
77
|
+
|
|
78
|
+
**触发**:会话存在设计交接块 / `【主题色系】` / 令牌 CSS(`:root` + `--primary-*` 等)产出。
|
|
79
|
+
|
|
80
|
+
**动作**:
|
|
81
|
+
|
|
82
|
+
1. 读 `references/design-handoff.md`。
|
|
83
|
+
2. 从会话/附件收集交接块与令牌 CSS,按 handoff 覆盖清单落地。
|
|
84
|
+
3. 比对项目 `design-tokens.scss` / `platform-config.json` 与产出主色;不一致则先落地。
|
|
85
|
+
4. 识别回执:`规范来源` = 上游产出 / 交接块;`目标规范` = `custom:<上游主题名>`。
|
|
86
|
+
5. 模版仍为出厂 `Theme: light` + `#409EFF` 且本轮要改依赖主题的页面时,同轮先完成样式覆盖清单。
|
|
87
|
+
|
|
82
88
|
### Step 1 探查现状(含命名锁定与模版版本判定)
|
|
83
89
|
|
|
84
90
|
1. 读业务项目 `src/styles/index.scss` 的 `@use` 列表与 `src/styles/` 目录。
|
|
@@ -96,9 +102,8 @@ tags: [design-system, design-tokens, antd, semi, arco, vuetify, findesign, eleme
|
|
|
96
102
|
|
|
97
103
|
### Step 2 修改/写入令牌层 `src/styles/design-tokens.scss`
|
|
98
104
|
|
|
99
|
-
>
|
|
100
|
-
>
|
|
101
|
-
> **旧项目/无该文件**:才允许按下方结构**新建**唯一一份 `design-tokens.scss`。
|
|
105
|
+
> **当前项目已有** `design-tokens.scss` → 只改令牌值(四段结构不动),不整文件覆盖、不另建一份。适配 = 改数据 + 改执行层。
|
|
106
|
+
> **当前项目没有该文件** → 按下方结构新建唯一一份。
|
|
102
107
|
|
|
103
108
|
结构固定为四段:用户可自定义 → 规范语义别名 → 模版桥接令牌 → Element Plus 映射。
|
|
104
109
|
|
|
@@ -380,10 +385,11 @@ tags: [design-system, design-tokens, antd, semi, arco, vuetify, findesign, eleme
|
|
|
380
385
|
|
|
381
386
|
| 位置 | 项目 | 规范落地动作 |
|
|
382
387
|
|---|---|---|
|
|
383
|
-
| `theme.scss` | 侧栏配色 |
|
|
384
|
-
| `index.scss` | 壳变量 | `--vts-
|
|
385
|
-
| `
|
|
386
|
-
| `
|
|
388
|
+
| `theme.scss` | 侧栏配色 | 将 `--vts-theme-*` 桥接到 upstream 派生的 `--sidebar-*`;`Theme` 取交接块 `data-theme` |
|
|
389
|
+
| `index.scss` | 壳变量 | `--vts-theme-menu-active-bg`、`--vts-sidebar-border-color` 桥接;`--vts-bar-height` 等照旧 |
|
|
390
|
+
| `sidebar.scss` | 侧栏执行 | 背景用 `background: var(--vts-theme-menu-bg)`(支持渐变);激活块 `--vts-theme-menu-active-bg`;边框 `--vts-sidebar-border-color` |
|
|
391
|
+
| `dark.scss` | 暗黑侧栏 | **禁止** `sidebar-container { background-color: var(--el-bg-color) }` 压盖渐变;改用 `background: var(--vts-theme-menu-bg)` |
|
|
392
|
+
| `platform-config.json` | 顶栏/主题 | `EpThemeColor` = 规范 primary-5;深色侧栏时 `Theme: default`(或对应 data-theme) |
|
|
387
393
|
| `layout/components/lay-tag` | 页签栏高度 | 走 `--vts-tabs-height`(桥接 `--tabs-height`) |
|
|
388
394
|
| `layout/components/lay-navbar` 等 | 顶栏内容区 | 行高/高度跟随 `--vts-bar-height`,禁止残留 `h-38` 等旧模版裸值 |
|
|
389
395
|
|
|
@@ -409,10 +415,11 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
409
415
|
- [ ] 控件高度:input/button 计算高度 = 规范值(24/32/40 或规范预设)
|
|
410
416
|
- [ ] 圆角:input、button、card、dialog 均为规范圆角
|
|
411
417
|
- [ ] 表格:表头底色/文字色/字重符合规范
|
|
412
|
-
- [ ] 卡片内边距:`.el-card__body` =
|
|
418
|
+
- [ ] 卡片内边距:`.el-card__body` = 规范 `--vts-card-padding`(桥接 `--card-padding`)
|
|
419
|
+
- [ ] 定高列表页:`el-card.vts-page-card` + `useTableSearch` 的 `tableHeight`;换 `--card-padding` 后列表仍无外层滚动条、分页完整、仅表格体内滚动
|
|
413
420
|
- [ ] 表单标签:computed font-weight 为规范值(AntD/Semi = 400,非 700)
|
|
414
421
|
- [ ] 弹窗:`--ds-dialog-bg` 为 **主题色轻渐变**(`primary-bg → component-bg`),非写死蓝渐变;`ElMessageBox` 内容区用 `--message-box-content-padding`(比 `el-dialog` body 更紧凑)
|
|
415
|
-
- [ ]
|
|
422
|
+
- [ ] 侧栏:深色主题下 DevTools 检查 `.sidebar-container` computed `background` 为 **渐变**(非单色 `#001529`);激活项块色 = `--primary-6`;Logo 区 = `--sidebar-logo-bg`
|
|
416
423
|
- [ ] 第四节冲突清单全部处理完毕(逐条回填)
|
|
417
424
|
- [ ] Step 7 存量扫描已执行且结果已输出
|
|
418
425
|
|
|
@@ -431,7 +438,7 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
431
438
|
|
|
432
439
|
## 四、模版自带硬编码冲突清单
|
|
433
440
|
|
|
434
|
-
>
|
|
441
|
+
> 来源:当前项目 `src/styles/`。已变量化(`var(--x, 默认值)`)的项走 4.A(桥接令牌接管);仍为裸硬编码的走 4.B(逐条改)。
|
|
435
442
|
|
|
436
443
|
| # | 文件 | 硬编码内容 | 与规范的冲突 | 新模版状态 | 旧项目处理 |
|
|
437
444
|
|---|------|-----------|-------------|-----------|-----------|
|
|
@@ -446,7 +453,7 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
446
453
|
| 9 | `element-plus.scss` | `.row-added/#e6f4ff`、`.row-modified/#fff7e6`、`.row-deleted/#f5f5f5` | 行变更色脱离规范且无暗色适配 | 已变量化 `--vts-row-*-bg` | 改 `--vts-row-*-bg` 令牌 |
|
|
447
454
|
| 10 | `element-plus.scss` | `.vts-message` 背景 `white`、文字 `#000000d9` | 暗黑/规范底失效 | 已变量化 `--vts-message-bg/text` | 改 `var(--vts-message-bg/text)` |
|
|
448
455
|
| 11 | `index.scss` / `dark.scss` | 旧默认 `--vts-dialog-bg: linear-gradient(#e5f3fe, #fefefe)`(写死蓝) | 弹窗背景应**跟随主题主色** | 已变量化:`--ds-dialog-bg: linear-gradient(var(--primary-bg), var(--component-bg))`;上游有 `--primary-bg` 则直接映射 | 旧项目改 `design-tokens` 的 `--ds-dialog-bg`,勿再写死 hex 渐变 |
|
|
449
|
-
| 12 | `theme.scss` | 8
|
|
456
|
+
| 12 | `theme.scss` | 8 套侧栏 `--vts-theme-*` 出厂单色 | 上游设计产出落地时需桥接 `--sidebar-*` | 模版保持出厂单色 | 按 `design-handoff.md` 动态写入 |
|
|
450
457
|
| 13 | `useApp.ts` | `epThemeColor` 缺省 `#409EFF` | EP 出厂蓝 ≠ 规范主色 | 不改代码 | 改 `platform-config.json` 的 `EpThemeColor`(Step 6) |
|
|
451
458
|
| 14 | `index.scss` | `--vts-bar-height: 38px`、`--vts-margin: 8px` | 与规范导航高度(AntD Pro 56px)不一致 | 令牌可覆盖 | 令牌层覆盖并回归验证列表页 `calc(100vh - ...)`;默认保持不变标注差异 |
|
|
452
459
|
| 15 | `button.scss` | `.btn/.golang/.php` 演示按钮(122×44 等) | 仅演示用,影响小 | 不处理 | 业务禁止使用这些类名 |
|
|
@@ -491,17 +498,15 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
491
498
|
|
|
492
499
|
---
|
|
493
500
|
|
|
494
|
-
##
|
|
495
|
-
|
|
496
|
-
> 上游可能是 `project-style-design`,也可能是任何同类 UI/UX 设计技能,甚至是用户手工整理的规范文档。**只认产出物,不认技能名**:无论哪个技能,只要产出了令牌/原型/规范文档,都按本协议解析。
|
|
501
|
+
## 七、与上游设计产出的衔接协议
|
|
497
502
|
|
|
498
|
-
|
|
503
|
+
细则见 `design-handoff.md`。
|
|
499
504
|
|
|
500
|
-
|
|
505
|
+
### 7.1 产出物识别
|
|
501
506
|
|
|
502
|
-
1.
|
|
503
|
-
2.
|
|
504
|
-
3.
|
|
507
|
+
1. 会话中的设计交接块 / 令牌表 / HTML 原型
|
|
508
|
+
2. 用户提供的含 `:root { --... }` 的文件或规范文档
|
|
509
|
+
3. 特征:`--brand-*` / `--primary` / `colorPrimary` / design token 表
|
|
505
510
|
|
|
506
511
|
### 7.2 令牌归一化(上游命名 ≠ 本模块标准名)
|
|
507
512
|
|
|
@@ -523,7 +528,7 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
523
528
|
|
|
524
529
|
### 7.3 落项目流程
|
|
525
530
|
|
|
526
|
-
|
|
531
|
+
当用户要求「把上游设计产出落到项目」:
|
|
527
532
|
|
|
528
533
|
1. 先输出识别回执(规范 = 稿子所用系统;不在预设内则标 `custom`,按 1.3)。
|
|
529
534
|
2. 按 7.2 / 7.5.2 归一化后,**修改**项目已有 `design-tokens.scss` 对应字段(有上游则覆盖,无则保留模版默认)。
|
|
@@ -537,14 +542,14 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
537
542
|
- 本模块与上游技能**解耦**:上游技能更名/替换不影响本协议,只需重新定位产出物。
|
|
538
543
|
- 禁止在本文档或生成代码中硬编码上游技能名作为流程前提;提及仅作举例。
|
|
539
544
|
- 上游只给视觉稿没给令牌时,从稿子的 computed 样式/标注反推令牌,并在回执中注明"反推"项。
|
|
540
|
-
-
|
|
545
|
+
- **默认值归属**:壳层默认像素/色值以当前项目 `src/styles/design-tokens.scss` 为准;本 Skill 不另造默认表。
|
|
541
546
|
|
|
542
547
|
### 7.5 壳层执行清单(模版接线 · 值随上游动态覆盖)
|
|
543
548
|
|
|
544
549
|
> **职责边界**
|
|
545
|
-
> -
|
|
546
|
-
> - **本 Skill
|
|
547
|
-
> -
|
|
550
|
+
> - **当前业务项目**:`design-tokens.scss` 提供壳层令牌字段与默认值;`sidebar.scss` / `layout/**` / `index.scss` 用 `var(--token)` 接线。
|
|
551
|
+
> - **本 Skill**:读产出 → 归一化(7.2 / 7.5.2)→ 改项目已有令牌字段 → grep 执行层仍引用令牌。
|
|
552
|
+
> - **无上游产出**:保留项目默认值,或按用户口述 / 内置预设改令牌。
|
|
548
553
|
|
|
549
554
|
#### 7.5.1 壳层令牌接线表(结构固定 · 值读模版或上游)
|
|
550
555
|
|
|
@@ -590,6 +595,8 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
590
595
|
| `--sidebar-collapsed-width` | 侧栏收起宽度 / collapsedWidth |
|
|
591
596
|
| `--el-menu-item-height` | 菜单项行高 / menuItemHeight / navItemHeight |
|
|
592
597
|
| `--sidebar-collapse-bar-height` | 侧栏折叠条高度 / collapseTriggerHeight |
|
|
598
|
+
| `--primary-0`~`--primary-9` | 会话令牌 CSS 块 / primaryScale / 10 级主色 |
|
|
599
|
+
| `--sidebar-bg` / `--sidebar-menu-active-bg` | 侧栏渐变底 / menuActiveBg / siderBackground |
|
|
593
600
|
|
|
594
601
|
#### 7.5.3 壳层令牌变更后的连锁巡检(按令牌名,不写死像素)
|
|
595
602
|
|
|
@@ -599,8 +606,10 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
599
606
|
2. `index.scss`:桥接 `--vts-bar-height` / `--vts-tabs-height` / `--vts-layout-header-offset*` 仍指向源令牌
|
|
600
607
|
3. `SidebarLogo.vue`、`lay-navbar`:高度/行高仍 `var(--vts-bar-height)` 或等价引用
|
|
601
608
|
4. `sidebar.scss`:`calc(100% - var(--header-height) - var(--sidebar-collapse-bar-height))`,禁止写死 px 组合
|
|
602
|
-
5. `lay-content/index.vue`:`padding-top
|
|
603
|
-
6.
|
|
609
|
+
5. `lay-content/index.vue`:`padding-top` 用 `--vts-layout-header-offset*`,禁止写死旧顶栏组合;**禁止**与 `$storage.configure.headerHeight` 双向联动
|
|
610
|
+
6. `lay-header`:布局/标签页变化须 `nextTick` 重测,且仅在高度变化时写回 `$storage.configure.headerHeight`
|
|
611
|
+
7. DevTools:顶栏 computed = **当前** `--header-height`;菜单项 = **当前** `--el-menu-item-height`(两者须不同)
|
|
612
|
+
8. 定高列表页:`--card-padding` / `--vts-card-padding` 变更后,抽查一页查询列表——内容区无外层滚动条、分页完整、`tableHeight` 随 padding 变化
|
|
604
613
|
|
|
605
614
|
#### 7.5.4 EP 菜单变量纪律
|
|
606
615
|
|
|
@@ -618,23 +627,24 @@ height: \d+px、padding: \d+px、font-size: \d+px、行内 style="...颜色 hex"
|
|
|
618
627
|
- [ ] 执行层 grep 无壳层裸 px 残留(EP 菜单根上的具体 px 须与 `--el-menu-item-height` 一致)
|
|
619
628
|
- [ ] 查询区 input 与 button 高度一致(small 档)
|
|
620
629
|
|
|
630
|
+
#### 7.5.7 侧栏整主题适配(上游产出 · 强制)
|
|
631
|
+
|
|
632
|
+
有上游设计产出且要求深色导航时,禁止只改 `--el-color-primary`。按 `design-handoff.md` 读取主色板并写入 `design-tokens` / `theme.scss` 桥接 / `platform-config.json`;`data-theme` 以交接块为准。
|
|
633
|
+
|
|
621
634
|
---
|
|
622
635
|
|
|
623
|
-
##
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
- **预设硬套**:把不在五大预设内的规范强行归入最接近的预设,或假设上游令牌名与本模块标准名一致而不做归一化映射。
|
|
639
|
-
- **只写令牌层、不执行壳层(最常见结合事故)**:改了 `--header-height` 等壳层令牌,但 `sidebar.scss` / `layout/` 仍用旧裸值或**误把 `--vts-bar-height` 套到菜单项** → 侧栏行高暴涨、折叠错位。见 **7.5 壳层执行清单**。
|
|
640
|
-
- **EP 菜单变量自引用**:`.el-menu { --el-menu-item-height: var(--el-menu-item-height, 40px) }` → 无效值,EP 回退默认 56px。须在 `.sidebar-container .el-menu` 写与 `--el-menu-item-height` 一致的具体值。
|
|
636
|
+
## 八、反例(短)
|
|
637
|
+
|
|
638
|
+
| 错误 | 正确 |
|
|
639
|
+
|------|------|
|
|
640
|
+
| 只改 `--el-color-primary` | 令牌层 + 几何 + 冲突清单全做 |
|
|
641
|
+
| 回执规范 ≠ 令牌/config/侧栏 | 三处同名同色 |
|
|
642
|
+
| 新建 `tokens.scss` 或独立重写层 | 仅 `design-tokens.scss`;几何并入 `element-plus.scss` |
|
|
643
|
+
| 冲突清单漏改 `reset.scss` body 字体 / `label { font-weight: 700 }` | 第四节逐条 grep(含无 `!important` 行) |
|
|
644
|
+
| 弹窗写死蓝渐变 | `--ds-dialog-bg` / `--primary-bg` |
|
|
645
|
+
| MessageBox 与 Dialog 共用同一 padding 令牌 | MessageBox 用 `--message-box-content-padding` |
|
|
646
|
+
| 改 `EpThemeColor` 未提醒清 localStorage | Step 6 提醒 |
|
|
647
|
+
| 业务页裸写控件高度 | 只引令牌 |
|
|
648
|
+
| 只写令牌不改壳层执行层 | 执行 7.5 |
|
|
649
|
+
| EP 菜单变量自引用 | 写与 `--el-menu-item-height` 一致的具体值 |
|
|
650
|
+
| Skill 文档写死顶栏/侧栏默认 px | 读模版 `design-tokens.scss` 或上游产出 |
|
|
@@ -1,100 +1,83 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
skill: detail-page
|
|
3
|
+
description: 列表→独立路由详情/编辑/查看。路由 meta、toDetail 写顶部 tag、activePath 保侧栏高亮、initToDetail。
|
|
4
|
+
scope: project
|
|
5
|
+
tags: [vue3, detail, toDetail, useDetail, activePath, showLink, multiTags, keepAlive]
|
|
6
|
+
---
|
|
2
7
|
|
|
3
|
-
|
|
8
|
+
# 详情页 / 编辑页跳转
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
真相源:模版 `useDetail.ts`、`multiTags`、侧栏 `NavVertical`。列表打开独立路由页时按本文件落地。
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
## 概念
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
14
|
+
| 能力 | 字段 / API |
|
|
15
|
+
|------|------------|
|
|
16
|
+
| 不进左侧菜单 | 路由 `meta.showLink: false` |
|
|
17
|
+
| 顶部 tag(multiTags) | `useDetail().toDetail` → `handleTags('push')` |
|
|
18
|
+
| 侧栏高亮 | 路由 `meta.activePath` = 列表 path |
|
|
19
|
+
| 页面缓存 | `meta.keepAlive`;多开 tag 再加 `moreTags: true` |
|
|
11
20
|
|
|
12
|
-
|
|
13
|
-
```
|
|
21
|
+
`showLink` 只管侧栏是否显示,不控制顶部 tag。详情不在菜单里 → 必须用 `toDetail` 写 tag;裸 `router.push` 只换路由。
|
|
14
22
|
|
|
15
|
-
##
|
|
23
|
+
## 路由(与列表兄弟)
|
|
16
24
|
|
|
17
25
|
```typescript
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
{
|
|
27
|
+
path: "/customer/detail",
|
|
28
|
+
name: "CustomerDetail",
|
|
29
|
+
component: () => import("@/views/customer/detail/index.vue"),
|
|
30
|
+
meta: {
|
|
31
|
+
title: "客户详情",
|
|
32
|
+
showLink: false,
|
|
33
|
+
activePath: "/customer/list",
|
|
34
|
+
// keepAlive: true,
|
|
35
|
+
// moreTags: true,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
22
38
|
```
|
|
23
39
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
| 参数 | 说明 |
|
|
40
|
+
| 字段 | 要求 |
|
|
27
41
|
|------|------|
|
|
28
|
-
| `
|
|
29
|
-
| `
|
|
30
|
-
| `
|
|
31
|
-
| `
|
|
42
|
+
| `title` | 非空 |
|
|
43
|
+
| `showLink: false` | 必填 |
|
|
44
|
+
| `activePath` | = 列表 path |
|
|
45
|
+
| `name` | = `defineOptions({ name })` |
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
## 列表打开
|
|
34
48
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<script setup lang="ts">
|
|
39
|
-
import { useDetail } from '@/hooks/useDetail'
|
|
40
|
-
|
|
41
|
-
defineOptions({ name: 'QueryDetail' }) // 必须与路由 name 一致
|
|
42
|
-
|
|
43
|
-
const { initToDetail, getParameter } = useDetail()
|
|
44
|
-
initToDetail('QueryDetail')
|
|
49
|
+
```typescript
|
|
50
|
+
import { useDetail } from "@/hooks/useDetail";
|
|
51
|
+
const { toDetail } = useDetail();
|
|
45
52
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
</script>
|
|
53
|
+
toDetail("CustomerDetail", { webId: "0" }, "(新增)");
|
|
54
|
+
toDetail("CustomerDetail", { id: row.id, text: row.name, mark: "edit" }, `(编辑)【${row.name}】`);
|
|
49
55
|
```
|
|
50
56
|
|
|
51
|
-
### 标签页标题自动生成
|
|
52
|
-
|
|
53
|
-
`initToDetail` 会根据参数自动生成多标签页标题:
|
|
54
|
-
|
|
55
|
-
| 条件 | 标题 |
|
|
56
|
-
|------|------|
|
|
57
|
-
| 无 `id` | `新增` |
|
|
58
|
-
| `mark === 'edit'` | `编辑【xxx】` |
|
|
59
|
-
| `mark === 'view'` | `查看【xxx】` |
|
|
60
|
-
|
|
61
|
-
## 数据回显
|
|
62
|
-
|
|
63
57
|
```typescript
|
|
64
|
-
|
|
65
|
-
const { id } = getParameter.value
|
|
66
|
-
if (!id) return
|
|
67
|
-
const res = await getDetailApi({ id })
|
|
68
|
-
Object.assign(formData, res.data)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
onMounted(() => {
|
|
72
|
-
getDetail()
|
|
73
|
-
})
|
|
58
|
+
toDetail(name, parameter, title?, model = "query") // model: "query" | "params"
|
|
74
59
|
```
|
|
75
60
|
|
|
76
|
-
|
|
61
|
+
写入 tag 时不要把路由上的 `showLink: false` 原样塞进 `handleTags` 的 meta。
|
|
77
62
|
|
|
78
|
-
|
|
63
|
+
## 详情页
|
|
79
64
|
|
|
80
65
|
```vue
|
|
81
66
|
<script setup lang="ts">
|
|
82
|
-
import { useDetail } from
|
|
83
|
-
|
|
84
|
-
const { getParameter } = useDetail()
|
|
85
|
-
|
|
86
|
-
const id =
|
|
67
|
+
import { useDetail } from "@/hooks/useDetail";
|
|
68
|
+
defineOptions({ name: "CustomerDetail" });
|
|
69
|
+
const { initToDetail, getParameter } = useDetail();
|
|
70
|
+
initToDetail("CustomerDetail");
|
|
71
|
+
const { id, mark } = getParameter as DetailParameter;
|
|
87
72
|
</script>
|
|
88
73
|
```
|
|
89
74
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
1. 详情页组件 `name` 必须与路由 `name` 一致,否则标签页标题功能异常。
|
|
93
|
-
2. 通过 `getParameter` 获取 `query` 或 `params` 参数,不要直接用 `useRoute()`。
|
|
94
|
-
3. 表单详情页回显:进入页面后调详情接口,用 `Object.assign(formData, data)` 赋值。
|
|
95
|
-
4. `mark` 字段控制页面编辑态:`view` 禁用表单,`edit` 可编辑,`create` 新增。
|
|
96
|
-
5. 选择类组件回填需同时维护 code 与 name(详见 data-writeback 模块)。
|
|
75
|
+
`initToDetail` 标题:无 id → `(新增)`;`mark===edit'` → `(编辑)【text】`;`view` → `(查看)【text】`。
|
|
97
76
|
|
|
98
|
-
##
|
|
77
|
+
## Must-do
|
|
99
78
|
|
|
100
|
-
|
|
79
|
+
1. 兄弟路由 + `showLink: false` + `activePath` + 非空 `title`
|
|
80
|
+
2. 列表只用 `toDetail`,禁止裸 `router.push`
|
|
81
|
+
3. 详情页必调 `initToDetail`;`name` 对齐
|
|
82
|
+
4. 参数用 `getParameter`
|
|
83
|
+
5. 需缓存 / 多开时配 `keepAlive` / `moreTags`
|
|
@@ -202,8 +202,7 @@ function parseAddress(text: string) {
|
|
|
202
202
|
|
|
203
203
|
## ReDialog 通用弹窗(必用)
|
|
204
204
|
|
|
205
|
-
> 落点:`src/components/ReDialog`。基于 `el-dialog
|
|
206
|
-
> 写法以**本模块下方黄金样板**为准(技能自包含,勿依赖仓库 views 演示页)。
|
|
205
|
+
> 落点:`src/components/ReDialog`。基于 `el-dialog`:居中、可拖拽、`destroy-on-close`、默认禁点遮罩关闭、可选全屏、内容区 `el-scrollbar`。写法见下方样板。
|
|
207
206
|
|
|
208
207
|
### Props / 插槽
|
|
209
208
|
|