king-design-analyzer 2.1.9 → 2.2.0

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.
Files changed (305) hide show
  1. package/components/actions.json +101 -0
  2. package/components/advancedset.json +127 -0
  3. package/components/affix.json +7 -0
  4. package/components/aksk.json +172 -0
  5. package/components/az.json +15 -2
  6. package/components/badge.json +7 -0
  7. package/components/billtypes.json +14 -2
  8. package/components/breadcrumb.json +7 -0
  9. package/components/button.json +191 -0
  10. package/components/buttonlink.json +73 -0
  11. package/components/card.json +8 -1
  12. package/components/cardcol.json +142 -0
  13. package/components/cardcols.json +121 -0
  14. package/components/cardcontent.json +15 -3
  15. package/components/cardtabs.json +172 -0
  16. package/components/carousel.json +7 -0
  17. package/components/cascader.json +520 -368
  18. package/components/checkbox.json +51 -4
  19. package/components/cidrinput.json +140 -0
  20. package/components/code.json +8 -1
  21. package/components/collapse.json +7 -0
  22. package/components/colorpicker.json +217 -0
  23. package/components/copy.json +7 -0
  24. package/components/copyhover.json +111 -0
  25. package/components/copyrow.json +124 -0
  26. package/components/datepicker.json +656 -524
  27. package/components/description.json +98 -0
  28. package/components/dialog.json +522 -455
  29. package/components/divider.json +8 -1
  30. package/components/drawer.json +571 -558
  31. package/components/dropdown.json +464 -384
  32. package/components/duration.json +125 -0
  33. package/components/editable.json +66 -0
  34. package/components/ellipsis.json +34 -1
  35. package/components/filtertablefieldsdialog.json +128 -0
  36. package/components/flex.json +151 -0
  37. package/components/form.json +131 -0
  38. package/components/formiteminput.json +214 -0
  39. package/components/formitemspinner.json +213 -0
  40. package/components/formitemswitch.json +185 -0
  41. package/components/formitemtableconfigs.json +210 -0
  42. package/components/grid.json +7 -0
  43. package/components/header.json +161 -0
  44. package/components/icon.json +13 -1
  45. package/components/icontooltip.json +19 -1
  46. package/components/input.json +188 -4
  47. package/components/instancelist.json +194 -0
  48. package/components/instancenum.json +196 -0
  49. package/components/ipinput.json +117 -0
  50. package/components/kspstatus.json +205 -0
  51. package/components/kvcode.json +120 -0
  52. package/components/layoutcontent.json +15 -3
  53. package/components/layoutlistcontent.json +148 -0
  54. package/components/layoutpermissioncontent.json +155 -0
  55. package/components/layoutstandardlist.json +275 -0
  56. package/components/layouttabs.json +168 -0
  57. package/components/lazymount.json +86 -0
  58. package/components/lazyteleport.json +118 -0
  59. package/components/menu.json +7 -0
  60. package/components/pagination.json +12 -0
  61. package/components/paginationplus.json +30 -3
  62. package/components/password.json +121 -0
  63. package/components/popover.json +457 -437
  64. package/components/projects.json +129 -0
  65. package/components/protable.json +97 -8
  66. package/components/queuevisualrange.json +110 -0
  67. package/components/radio.json +82 -2
  68. package/components/rate.json +199 -0
  69. package/components/region.json +14 -2
  70. package/components/search.json +221 -0
  71. package/components/searchinput.json +132 -0
  72. package/components/searchitems.json +215 -0
  73. package/components/searchselect.json +195 -0
  74. package/components/select.json +686 -666
  75. package/components/sidebar.json +198 -0
  76. package/components/skeleton.json +233 -0
  77. package/components/spin.json +8 -1
  78. package/components/split.json +260 -0
  79. package/components/sshkeys.json +138 -0
  80. package/components/status.json +60 -3
  81. package/components/steps.json +7 -0
  82. package/components/switch.json +8 -1
  83. package/components/table.json +18 -1
  84. package/components/tablecolumnid.json +14 -2
  85. package/components/tabs.json +12 -0
  86. package/components/timeline.json +213 -0
  87. package/components/timepicker.json +147 -3
  88. package/components/timerange.json +262 -0
  89. package/components/tip.json +7 -0
  90. package/components/tooltip.json +484 -395
  91. package/components/tour.json +418 -372
  92. package/components/transfer.json +27 -3
  93. package/components/tree.json +6 -4
  94. package/components/treeselect.json +556 -475
  95. package/components/upload.json +474 -473
  96. package/components/vdialog.json +308 -0
  97. package/components/vdrawer.json +331 -0
  98. package/components/virtuallist.json +7 -0
  99. package/dist/ast/index.d.mts +35 -1
  100. package/dist/ast/index.d.ts +35 -1
  101. package/dist/ast/index.js +4 -3
  102. package/dist/ast/index.mjs +2 -1
  103. package/dist/{chunk-DSWKLUIX.mjs → chunk-3LYQ5XFM.mjs} +1 -1
  104. package/dist/chunk-BI5TIQID.mjs +330 -0
  105. package/dist/{chunk-F26GUCGG.js → chunk-CJGGFVQJ.js} +8 -8
  106. package/dist/chunk-CR3GC4H3.js +353 -0
  107. package/dist/{chunk-NZ6TLWMD.mjs → chunk-D2SXGGTX.mjs} +28 -17
  108. package/dist/{chunk-D3Y6FGWA.js → chunk-EYKZY2F3.js} +29 -18
  109. package/dist/chunk-KF5YBEM5.js +143 -0
  110. package/dist/{chunk-H2ET6MMM.mjs → chunk-KMIDURUR.mjs} +42 -47
  111. package/dist/chunk-QC6VTSA3.mjs +117 -0
  112. package/dist/{chunk-2W6OCG2S.js → chunk-SZYVGYKK.js} +42 -48
  113. package/dist/{chunk-WYSRJVX4.js → chunk-TA3SV4SP.js} +2 -2
  114. package/dist/{chunk-OJOHB64C.mjs → chunk-XGPHQHLR.mjs} +4 -4
  115. package/dist/full/index.js +7 -6
  116. package/dist/full/index.mjs +5 -4
  117. package/dist/index.d.mts +1 -0
  118. package/dist/index.d.ts +1 -0
  119. package/dist/index.js +14 -13
  120. package/dist/index.mjs +6 -5
  121. package/dist/metadata/index.d.mts +22 -2
  122. package/dist/metadata/index.d.ts +22 -2
  123. package/dist/metadata/index.js +26 -16
  124. package/dist/metadata/index.mjs +26 -15
  125. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  126. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  127. package/dist/runtime/index.js +4 -4
  128. package/dist/runtime/index.mjs +2 -2
  129. package/dist/shared/index.d.mts +10 -0
  130. package/dist/shared/index.d.ts +10 -0
  131. package/dist/shared/index.js +23 -0
  132. package/dist/shared/index.mjs +2 -0
  133. package/dist/static/index.js +5 -5
  134. package/dist/static/index.mjs +2 -2
  135. package/docs_for_llm/actions.doc.md +77 -0
  136. package/docs_for_llm/advancedset.doc.md +89 -0
  137. package/docs_for_llm/affix.doc.md +15 -7
  138. package/docs_for_llm/aksk.doc.md +111 -0
  139. package/docs_for_llm/az.doc.md +17 -11
  140. package/docs_for_llm/badge.doc.md +6 -5
  141. package/docs_for_llm/billtypes.doc.md +17 -11
  142. package/docs_for_llm/breadcrumb.doc.md +6 -3
  143. package/docs_for_llm/button.doc.md +34 -18
  144. package/docs_for_llm/buttonlink.doc.md +55 -0
  145. package/docs_for_llm/card.doc.md +8 -5
  146. package/docs_for_llm/cardcol.doc.md +78 -0
  147. package/docs_for_llm/cardcols.doc.md +84 -0
  148. package/docs_for_llm/cardcontent.doc.md +10 -10
  149. package/docs_for_llm/cardtabs.doc.md +106 -0
  150. package/docs_for_llm/carousel.doc.md +8 -7
  151. package/docs_for_llm/cascader.doc.md +46 -25
  152. package/docs_for_llm/checkbox.doc.md +25 -13
  153. package/docs_for_llm/cidrinput.doc.md +83 -0
  154. package/docs_for_llm/code.doc.md +22 -11
  155. package/docs_for_llm/collapse.doc.md +9 -6
  156. package/docs_for_llm/colorpicker.doc.md +104 -0
  157. package/docs_for_llm/copy.doc.md +15 -13
  158. package/docs_for_llm/copyhover.doc.md +59 -0
  159. package/docs_for_llm/copyrow.doc.md +71 -0
  160. package/docs_for_llm/datepicker.doc.md +51 -39
  161. package/docs_for_llm/description.doc.md +75 -0
  162. package/docs_for_llm/descriptions.doc.md +9 -6
  163. package/docs_for_llm/dialog.doc.md +48 -77
  164. package/docs_for_llm/divider.doc.md +9 -7
  165. package/docs_for_llm/drawer.doc.md +43 -84
  166. package/docs_for_llm/dropdown.doc.md +52 -21
  167. package/docs_for_llm/duration.doc.md +76 -0
  168. package/docs_for_llm/editable.doc.md +36 -14
  169. package/docs_for_llm/ellipsis.doc.md +10 -5
  170. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  171. package/docs_for_llm/flex.doc.md +74 -0
  172. package/docs_for_llm/form.doc.md +33 -14
  173. package/docs_for_llm/formiteminput.doc.md +128 -0
  174. package/docs_for_llm/formitemspinner.doc.md +105 -0
  175. package/docs_for_llm/formitemswitch.doc.md +113 -0
  176. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  177. package/docs_for_llm/grid.doc.md +7 -5
  178. package/docs_for_llm/header.doc.md +85 -0
  179. package/docs_for_llm/icon.doc.md +12 -8
  180. package/docs_for_llm/icontooltip.doc.md +121 -0
  181. package/docs_for_llm/input.doc.md +90 -39
  182. package/docs_for_llm/instancelist.doc.md +113 -0
  183. package/docs_for_llm/instancenum.doc.md +95 -0
  184. package/docs_for_llm/ipinput.doc.md +77 -0
  185. package/docs_for_llm/kspstatus.doc.md +82 -0
  186. package/docs_for_llm/kvcode.doc.md +76 -0
  187. package/docs_for_llm/layoutcontent.doc.md +17 -17
  188. package/docs_for_llm/layoutlistcontent.doc.md +95 -0
  189. package/docs_for_llm/layoutpermissioncontent.doc.md +84 -0
  190. package/docs_for_llm/layoutstandardlist.doc.md +120 -0
  191. package/docs_for_llm/layouttabs.doc.md +101 -0
  192. package/docs_for_llm/lazymount.doc.md +73 -0
  193. package/docs_for_llm/lazyteleport.doc.md +76 -0
  194. package/docs_for_llm/menu.doc.md +14 -11
  195. package/docs_for_llm/message.doc.md +48 -10
  196. package/docs_for_llm/pagination.doc.md +30 -17
  197. package/docs_for_llm/paginationplus.doc.md +31 -10
  198. package/docs_for_llm/password.doc.md +86 -0
  199. package/docs_for_llm/popover.doc.md +24 -55
  200. package/docs_for_llm/progress.doc.md +13 -10
  201. package/docs_for_llm/projects.doc.md +91 -0
  202. package/docs_for_llm/protable.doc.md +89 -15
  203. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  204. package/docs_for_llm/radio.doc.md +23 -8
  205. package/docs_for_llm/rate.doc.md +122 -0
  206. package/docs_for_llm/region.doc.md +25 -13
  207. package/docs_for_llm/search.doc.md +120 -0
  208. package/docs_for_llm/searchinput.doc.md +111 -0
  209. package/docs_for_llm/searchitems.doc.md +116 -0
  210. package/docs_for_llm/searchselect.doc.md +126 -0
  211. package/docs_for_llm/select.doc.md +40 -55
  212. package/docs_for_llm/sidebar.doc.md +133 -0
  213. package/docs_for_llm/skeleton.doc.md +117 -0
  214. package/docs_for_llm/slider.doc.md +31 -21
  215. package/docs_for_llm/spin.doc.md +8 -5
  216. package/docs_for_llm/spinner.doc.md +28 -18
  217. package/docs_for_llm/split.doc.md +157 -0
  218. package/docs_for_llm/sshkeys.doc.md +88 -0
  219. package/docs_for_llm/status.doc.md +14 -9
  220. package/docs_for_llm/steps.doc.md +10 -7
  221. package/docs_for_llm/switch.doc.md +17 -14
  222. package/docs_for_llm/table.doc.md +118 -51
  223. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  224. package/docs_for_llm/tabs.doc.md +19 -10
  225. package/docs_for_llm/tag.doc.md +19 -10
  226. package/docs_for_llm/timeline.doc.md +109 -0
  227. package/docs_for_llm/timepicker.doc.md +57 -38
  228. package/docs_for_llm/timerange.doc.md +157 -0
  229. package/docs_for_llm/tip.doc.md +20 -11
  230. package/docs_for_llm/tooltip.doc.md +55 -29
  231. package/docs_for_llm/tour.doc.md +48 -29
  232. package/docs_for_llm/transfer.doc.md +40 -29
  233. package/docs_for_llm/tree.doc.md +65 -23
  234. package/docs_for_llm/treeselect.doc.md +37 -48
  235. package/docs_for_llm/upload.doc.md +56 -32
  236. package/docs_for_llm/useCRUD.doc.md +49 -0
  237. package/docs_for_llm/useCountdown.doc.md +43 -0
  238. package/docs_for_llm/useDetail.doc.md +48 -0
  239. package/docs_for_llm/useDialog.doc.md +46 -0
  240. package/docs_for_llm/useEntity.doc.md +45 -0
  241. package/docs_for_llm/useEventListener.doc.md +44 -0
  242. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  243. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  244. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  245. package/docs_for_llm/useGroup.doc.md +48 -0
  246. package/docs_for_llm/useIdEntities.doc.md +48 -0
  247. package/docs_for_llm/useIdEntity.doc.md +103 -0
  248. package/docs_for_llm/useInterval.doc.md +43 -0
  249. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  250. package/docs_for_llm/useMessage.doc.md +46 -0
  251. package/docs_for_llm/useModifyCache.doc.md +37 -0
  252. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  253. package/docs_for_llm/usePagination.doc.md +60 -0
  254. package/docs_for_llm/usePersist.doc.md +54 -0
  255. package/docs_for_llm/usePoll.doc.md +41 -0
  256. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  257. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  258. package/docs_for_llm/useSearch.doc.md +68 -0
  259. package/docs_for_llm/useShell.doc.md +43 -0
  260. package/docs_for_llm/useSkip.doc.md +41 -0
  261. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  262. package/docs_for_llm/useStore.doc.md +34 -0
  263. package/docs_for_llm/useTable.doc.md +57 -0
  264. package/docs_for_llm/useTableGroup.doc.md +47 -0
  265. package/docs_for_llm/useTableSort.doc.md +40 -0
  266. package/docs_for_llm/useToState.doc.md +112 -0
  267. package/docs_for_llm/useUser.doc.md +38 -0
  268. package/docs_for_llm/useValidForm.doc.md +41 -0
  269. package/docs_for_llm/vdialog.doc.md +129 -0
  270. package/docs_for_llm/vdrawer.doc.md +119 -0
  271. package/docs_for_llm/virtuallist.doc.md +6 -3
  272. package/hooks/useCRUD.json +61 -0
  273. package/hooks/useCountdown.json +49 -0
  274. package/hooks/useDetail.json +67 -0
  275. package/hooks/useDialog.json +49 -0
  276. package/hooks/useEntity.json +61 -0
  277. package/hooks/useEventListener.json +61 -0
  278. package/hooks/useFalseUntilTruthy.json +43 -0
  279. package/hooks/useGetCopyAuthText.json +36 -0
  280. package/hooks/useGetUserPermission.json +55 -0
  281. package/hooks/useGroup.json +49 -0
  282. package/hooks/useIdEntities.json +61 -0
  283. package/hooks/useInterval.json +55 -0
  284. package/hooks/useLayoutStandardList.json +36 -0
  285. package/hooks/useMessage.json +73 -0
  286. package/hooks/useModifyCache.json +36 -0
  287. package/hooks/useOpenDialog.json +43 -0
  288. package/hooks/usePagination.json +49 -0
  289. package/hooks/usePersist.json +61 -0
  290. package/hooks/usePoll.json +43 -0
  291. package/hooks/useRoutePlus.json +36 -0
  292. package/hooks/useRouterPlus.json +36 -0
  293. package/hooks/useSearch.json +56 -0
  294. package/hooks/useShell.json +49 -0
  295. package/hooks/useSkip.json +43 -0
  296. package/hooks/useStorageIdEntity.json +67 -0
  297. package/hooks/useStore.json +36 -0
  298. package/hooks/useTable.json +49 -0
  299. package/hooks/useTableGroup.json +43 -0
  300. package/hooks/useTableSort.json +43 -0
  301. package/hooks/useUser.json +36 -0
  302. package/hooks/useValidForm.json +43 -0
  303. package/package.json +12 -6
  304. package/dist/chunk-HPAUCD5I.js +0 -156
  305. package/dist/chunk-L4DS3EXI.mjs +0 -133
@@ -12,20 +12,35 @@ import { Form, FormItem } from '@king-design/vue';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | labelWidth | `string | number` | `undefined` | 否 | 定义所有子孙 FormItem 组件的 label 宽度 | `<Form :labelWidth="120"></Form>` |
18
- | layout | `"horizontal" | "vertical" | "inline"` | `"horizontal"` | 否 | 指定表单布局方式 | `<Form layout="vertical"></Form>` |
19
- | starOnRequired | `boolean` | `false` | 否 | 当 FormItem 必填时,是否在 label 前面展示 * | `<Form starOnRequired></Form>` |
20
- | size | `"default" | "small" | "mini"` | `"default"` | 否 | 定义表单之间的间隔大小 | `<Form size="small"></Form>` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | labelWidth | `string | number` | `undefined` | 否 | 定义所有子孙 FormItem 组件的 label 宽度 | - | `<Form :labelWidth="120"></Form>` |
18
+ | layout | `"horizontal" | "vertical" | "inline"` | `"horizontal"` | 否 | 指定表单布局方式 | - | `<Form layout="vertical"></Form>` |
19
+ | starOnRequired | `boolean` | `false` | 否 | 当 FormItem 必填时,是否在 label 前面展示 * | - | `<Form starOnRequired></Form>` |
20
+ | size | `"default" | "small" | "mini"` | `"default"` | 否 | 定义表单之间的间隔大小 | - | `<Form size="small"></Form>` |
21
+ | acceptcharset | `string` | `undefined` | 否 | 原生 acceptcharset 属性,指定服务器可处理的字符编码 | `native` | `<Form acceptcharset="UTF-8"></Form>` |
22
+ | autocomplete | `string` | `undefined` | 否 | 原生 autocomplete 属性,指定表单自动补全行为 | `native` | `<Form autocomplete="off"></Form>` |
23
+ | name | `string` | `undefined` | 否 | 原生 name 属性 | `native` | `<Form name="loginForm"></Form>` |
24
+ | rel | `string` | `undefined` | 否 | 原生 rel 属性,指定表单与目标资源的关系 | `native` | `<Form rel="external"></Form>` |
25
+ | action | `string` | `undefined` | 否 | 原生 action 属性,指定表单提交地址 | `native` | `<Form action="/api/submit"></Form>` |
26
+ | enctype | `string` | `undefined` | 否 | 原生 enctype 属性,指定表单提交编码类型 | `native` | `<Form enctype="multipart/form-data"></Form>` |
27
+ | method | `"post" | "get" | "dialog"` | `undefined` | 否 | 原生 method 属性,指定表单提交方法 | `native` | `<Form method="post"></Form>` |
28
+ | novalidate | `boolean` | `undefined` | 否 | 原生 novalidate 属性,提交时跳过原生表单校验 | `native` | `<Form novalidate></Form>` |
29
+ | target | `string` | `undefined` | 否 | 原生 target 属性,指定表单响应的打开位置 | `native` | `<Form target="_blank"></Form>` |
21
30
 
22
31
  ## 事件 (Events)
23
32
  | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
24
33
  | --- | --- | --- | --- | --- |
25
34
  | submit | `@submit` | 当表单提交并且所有规则都验证通过时触发 | `event: Event` | `<Form @submit="handleSubmit"></Form>` |
26
35
 
27
- ### 事件处理函数示例
28
- **submit**:
36
+ ### 事件参数说明
37
+ **submit**
38
+
39
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
40
+ | --- | --- | --- | --- | --- |
41
+ | event | `Event` | 是 | - | 原生表单提交事件对象 |
42
+
43
+ 事件处理示例:
29
44
  ```typescript
30
45
  const handleSubmit = (e: Event) => {
31
46
  console.log('表单验证通过,提交中...');
@@ -35,10 +50,10 @@ const handleSubmit = (e: Event) => {
35
50
  ## 方法 (Methods)
36
51
  | 方法名 | 说明 | 参数 | 返回值 |
37
52
  | --- | --- | --- | --- |
38
- | validate | 验证表单所有规则 | `` | `Promise<boolean>` |
39
- | reset | 重置表单验证状态 | `` | `void` |
40
- | getFirstInvalidFormItem | 获取第一条出错的 FormItem | `` | `FormItem` |
41
- | getAllInvalidFormItems | 获取所有校验失败的 FormItem | `` | `FormItem[]` |
53
+ | validate | 验证表单所有规则 | `-` | `Promise<boolean>` |
54
+ | reset | 重置表单验证状态 | `-` | `void` |
55
+ | getFirstInvalidFormItem | 获取第一条出错的 FormItem | `-` | `FormItem` |
56
+ | getAllInvalidFormItems | 获取所有校验失败的 FormItem | `-` | `FormItem[]` |
42
57
 
43
58
  ## 子组件 (Sub-Components)
44
59
  ### FormItem
@@ -63,6 +78,7 @@ const handleSubmit = (e: Event) => {
63
78
  - `undefined`: 往后面追加的内容
64
79
 
65
80
  ## 常见错误与正确用法 (Anti-Hallucination)
81
+ ### FormItem 配置了 rules 但未绑定 value
66
82
  > **错误用法**: `<FormItem label="用户名" :rules="{required: true}">
67
83
  <Input v-model="model.username" />
68
84
  </FormItem>`
@@ -71,14 +87,17 @@ const handleSubmit = (e: Event) => {
71
87
  </FormItem>`
72
88
  > **说明**: 使用验证规则时,必须通过 :value 属性绑定需要验证的数据,否则验证不会生效
73
89
 
90
+ ### 使用不存在的 layout 值
74
91
  > **错误用法**: `<Form layout="flex">`
75
92
  > **正确写法**: `<Form layout="horizontal">`
76
93
  > **说明**: Form 的 layout 只支持 horizontal, vertical, inline 三种值
77
94
 
95
+ ### rules 格式错误
78
96
  > **错误用法**: `<FormItem :rules="'required'">`
79
97
  > **正确写法**: `<FormItem :rules="{required: true}">`
80
98
  > **说明**: rules 必须是对象格式,key 为规则名,value 为规则参数(通常为 true 或具体值)
81
99
 
100
+ ### validate 方法未使用 await
82
101
  > **错误用法**: `const valid = form.value?.validate();
83
102
  if (valid) { /* ... */ }`
84
103
  > **正确写法**: `const valid = await form.value?.validate();
@@ -91,7 +110,7 @@ if (valid) { /* ... */ }`
91
110
 
92
111
  基本的表单验证用法
93
112
 
94
- **使用的 API**: 属性: label, value, rules | 事件: submit
113
+ **使用的 API**: 属性: label, value, rules | 事件: submit | 方法: validate
95
114
 
96
115
  ```vue
97
116
  <script setup lang="ts">
@@ -271,7 +290,7 @@ const model = reactive({
271
290
 
272
291
  重置表单验证状态
273
292
 
274
- **使用的 API**: 属性: label, value, rules
293
+ **使用的 API**: 属性: label, value, rules | 方法: reset
275
294
 
276
295
  ```vue
277
296
  <script setup lang="ts">
@@ -0,0 +1,128 @@
1
+ # 输入框表单项 (FormItemInput)
2
+
3
+ 带标题、必填、规则校验和辅助说明的输入框表单项,适合业务表单中承载实例名称、域名、备注等字段。
4
+
5
+ **关键词**: form item input, business input, 输入框表单项, 表单输入, 名称输入
6
+
7
+ **使用场景**: 常规文本输入、业务表单字段录入、高风险字段提示输入
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { FormItemInput } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | type | `string` | `"text"` | 否 | 在原生 input 标签的 type 取值的基础上扩展了 textarea 值,当取该值时渲染成 <textarea> | `inherited:Input` | `<Input type="textarea" :rows="4" placeholder="请输入内容" />` |
18
+ | name | `string` | `undefined` | 否 | 原生 input 标签的 name 属性 | `native`, `inherited:Input` | `<Input name="username" />` |
19
+ | readonly | `boolean` | `false` | 否 | 是否只读 | `native`, `inherited:Input` | `<Input v-model="value" readonly />` |
20
+ | autocomplete | `string` | `undefined` | 否 | 原生 autocomplete 属性,指定浏览器自动补全行为 | `native`, `inherited:Input` | `<Input autocomplete="username" />` |
21
+ | autofocus | `boolean` | `undefined` | 否 | 原生 autofocus 属性,页面加载后自动聚焦输入框 | `native`, `inherited:Input` | `<Input autofocus />` |
22
+ | form | `string` | `undefined` | 否 | 原生 form 属性,指定输入框关联的表单 id | `native`, `inherited:Input` | `<Input form="searchForm" />` |
23
+ | maxlength | `number | string` | `undefined` | 否 | 原生 maxlength 属性,限制最大输入长度 | `native`, `inherited:Input` | `<Input :maxlength="50" showCount />` |
24
+ | pattern | `string` | `undefined` | 否 | 原生 pattern 属性,指定输入值需要匹配的正则模式 | `native`, `inherited:Input` | `<Input pattern="[0-9]{6}" placeholder="请输入6位数字" />` |
25
+ | required | `boolean` | `false` | 否 | 是否必填 | - | - |
26
+ | clearable | `boolean` | `false` | 否 | 是否展示快速清除按钮 | `inherited:Input` | `<Input v-model="value" clearable />` |
27
+ | disabled | `boolean` | `false` | 否 | 是否禁用 | `inherited:Input` | `<Input disabled placeholder="禁用状态" />` |
28
+ | size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 组件尺寸 | `inherited:Input` | `<Input size="large" placeholder="大尺寸输入框" />` |
29
+ | rows | `number | string` | `2` | 否 | 当 type="textarea" 时,默认展示文本行数 | `native`, `inherited:Input` | `<Input type="textarea" :rows="6" />` |
30
+ | cols | `number` | `undefined` | 否 | 原生 cols 属性,当 type="textarea" 时指定可见宽度 | `native`, `inherited:Input` | `<Input type="textarea" :cols="40" />` |
31
+ | datalist | `string` | `undefined` | 否 | 原生 datalist 属性,关联 datalist 元素 id | `native`, `inherited:Input` | `<Input datalist="city-list" />` |
32
+ | dirname | `string` | `undefined` | 否 | 原生 dirname 属性,提交时附带输入方向信息 | `native`, `inherited:Input` | `<Input dirname="comment.dir" />` |
33
+ | wrap | `"hard" | "soft"` | `undefined` | 否 | 原生 wrap 属性,当 type="textarea" 时指定换行提交方式 | `native`, `inherited:Input` | `<Input type="textarea" wrap="hard" />` |
34
+ | autoWidth | `boolean` | `false` | 否 | 是否宽度随输入的文本的长度变化而变化 | `inherited:Input` | `<Input autoWidth placeholder="宽度自适应" />` |
35
+ | fluid | `boolean` | `false` | 否 | 是否宽度 100% | `inherited:Input` | `<Input fluid placeholder="宽度100%" />` |
36
+ | width | `string | number` | `undefined` | 否 | 指定宽度,组件会加上单位 px | `inherited:Input` | `<Input :width="300" placeholder="宽度300px" />` |
37
+ | stackClearIcon | `boolean` | `false` | 否 | 是否将清空按钮覆盖在 suffix 按钮上展示来节省空间 | `inherited:Input` | `<Input clearable stackClearIcon />` |
38
+ | frozenOnInput | `boolean` | `false` | 否 | 是否在输入的过程中冻结 value 更新到视图 | `inherited:Input` | `<Input frozenOnInput />` |
39
+ | inline | `boolean` | `false` | 否 | 是否展示内联模式 | `inherited:Input` | `<Input inline />` |
40
+ | waveDisabled | `boolean` | `false` | 否 | 是否禁用点击波纹效果 | `inherited:Input` | `<Input waveDisabled />` |
41
+ | resize | `"none" | "vertical" | "horizontal" | "both"` | `"vertical"` | 否 | 指定 textarea 输入框拖动调整大小的方向,默认只能垂直方向调整 | `inherited:Input` | `<Input type="textarea" resize="both" />` |
42
+ | flat | `boolean` | `false` | 否 | 是否展示扁平样式 | `inherited:Input` | `<Input flat placeholder="扁平样式" />` |
43
+ | showCount | `boolean` | `false` | 否 | 是否展示字符长度提示数字 | `inherited:Input` | `<Input showCount maxlength="50" />` |
44
+ | showPassword | `boolean` | `false` | 否 | 当 type="password" 时,是否展示显隐密码按钮 | `inherited:Input` | `<Input type="password" showPassword />` |
45
+ | modelValue | `string | null` | `undefined` | 否 | 当前输入值 | - | - |
46
+ | hideLabel | `boolean` | `undefined` | 否 | 是否隐藏 label 区域 | - | - |
47
+ | label | `string` | `""` | 否 | 表单项标题 | - | - |
48
+ | placeholder | `string` | `undefined` | 否 | 输入框占位文案 | - | - |
49
+ | tip | `string` | `undefined` | 否 | 输入框下方提示文案 | - | - |
50
+ | warnTip | `string` | `undefined` | 否 | 警告提示文案 | - | - |
51
+ | helper | `string` | `undefined` | 否 | 辅助说明文案 | - | - |
52
+ | rules | `Record<string, any>` | `{}` | 否 | 表单校验规则 | - | - |
53
+ | info | `string` | `undefined` | 否 | 信息提示文案 | - | - |
54
+
55
+ ## 事件 (Events)
56
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
57
+ | --- | --- | --- | --- | --- |
58
+ | update:modelValue | `@update:modelValue` | 输入框值实时变化时触发,适合双向绑定表单字段。 | `value?: string | null` | - |
59
+ | change:value | `@change:value` | 输入值完成一次确认变更时触发,通常用于失焦校验或联动查询。 | `value?: string | null` | - |
60
+
61
+ ### 事件参数说明
62
+ **update:modelValue**
63
+
64
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
65
+ | --- | --- | --- | --- | --- |
66
+ | value | `string | null` | 否 | - | 当前输入框中的值。 |
67
+
68
+ **change:value**
69
+
70
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
71
+ | --- | --- | --- | --- | --- |
72
+ | value | `string | null` | 否 | - | 本次确认后的输入值。 |
73
+
74
+ ## 使用示例
75
+ ### 实例名称输入项
76
+ **场景**: 在创建实例表单中录入资源名称。
77
+
78
+ 结合 label、placeholder 和 tip 构造标准业务表单项。
79
+
80
+ **使用的 API**: 属性: modelValue, label, placeholder, tip, required | 事件: update:modelValue
81
+
82
+ ```vue
83
+ <script setup lang="ts">
84
+ import { ref } from 'vue';
85
+ import { FormItemInput } from '@ksyun-internal/versatile';
86
+
87
+ const instanceName = ref('web-prod-01');
88
+ </script>
89
+
90
+ <template>
91
+ <FormItemInput
92
+ v-model="instanceName"
93
+ label="实例名称"
94
+ placeholder="请输入实例名称"
95
+ tip="长度 2 到 63 个字符,支持字母、数字和中划线"
96
+ :required="true"
97
+ />
98
+ </template>
99
+ ```
100
+
101
+ ### 带警告提示的输入项
102
+ **场景**: 在高风险配置项旁直接展示风险和补充说明。
103
+
104
+ 在输入可能影响线上流量的字段时补充警告说明。
105
+
106
+ **使用的 API**: 属性: modelValue, label, warnTip, info
107
+
108
+ ```vue
109
+ <script setup lang="ts">
110
+ import { ref } from 'vue';
111
+ import { FormItemInput } from '@ksyun-internal/versatile';
112
+
113
+ const domain = ref('api.example.com');
114
+ </script>
115
+
116
+ <template>
117
+ <FormItemInput
118
+ v-model="domain"
119
+ label="回源域名"
120
+ warn-tip="修改后可能影响现网回源路径"
121
+ info="请确保 DNS 已正确解析"
122
+ />
123
+ </template>
124
+ ```
125
+
126
+ ## 相关组件
127
+ Input, FormItemSpinner
128
+
@@ -0,0 +1,105 @@
1
+ # 数字步进表单项 (FormItemSpinner)
2
+
3
+ 把数字步进器和表单项包装在一起的业务组件,适合 CPU 核数、带宽、节点数等带单位和范围限制的数值输入。
4
+
5
+ **关键词**: form item spinner, number input, 数字步进, 表单项, 带单位输入
6
+
7
+ **使用场景**: 数量输入、规格和配额设置、带精度控制的数值输入
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { FormItemSpinner } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | disabled | `boolean` | `false` | 否 | 是否禁用 | `inherited:Spinner` | `<Spinner disabled />` |
18
+ | max | `number` | `Infinity` | 否 | 最大值 | - | - |
19
+ | min | `number` | `0` | 否 | 最小值 | - | - |
20
+ | step | `number` | `1` | 否 | 步长 | - | - |
21
+ | size | `"default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | `inherited:Spinner` | `<Spinner size="small" />` |
22
+ | vertical | `boolean` | `false` | 否 | 控制按钮是否竖直排列 | `inherited:Spinner` | `<Spinner vertical />` |
23
+ | precision | `number` | `0` | 否 | 保留小数位数 | - | - |
24
+ | formatter | `(value: number) => string` | `undefined` | 否 | 定义格式化展示值的函数 | `inherited:Spinner` | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
25
+ | parser | `(value: string) => number` | `undefined` | 否 | 与 formatter 结合使用,定义解析格式化的值的函数 | `inherited:Spinner` | `<Spinner :formatter="(val) => `${val}%`" :parser="(val) => parseFloat(val)" /></Spinner>` |
26
+ | prefix | `string` | `undefined` | 否 | 定义展示的值的前缀,优先级低于 formatter | `inherited:Spinner` | `<Spinner prefix="¥" />` |
27
+ | suffix | `string` | `undefined` | 否 | 定义展示的值的后缀,优先级低于 formatter | `inherited:Spinner` | `<Spinner suffix="元" />` |
28
+ | width | `string | number` | `undefined` | 否 | 指定 Input 输入框的宽度 | `inherited:Spinner` | `<Spinner :width="150" />` |
29
+ | forceStep | `boolean` | `false` | 否 | value 值除了边界值,都必须满足 min + step * n(n 为整数) | `inherited:Spinner` | `<Spinner :min="0" :step="5" forceStep />` |
30
+ | modelValue | `number | null` | `undefined` | 否 | 当前数值 | - | - |
31
+ | label | `string` | `undefined` | 否 | 表单项标题 | - | - |
32
+ | required | `boolean` | `false` | 否 | 是否必填 | - | - |
33
+ | rules | `Record<string, any>` | `{}` | 否 | 表单校验规则 | - | - |
34
+ | helper | `string` | `undefined` | 否 | 辅助说明文案 | - | - |
35
+ | info | `string` | `undefined` | 否 | 信息提示文案 | - | - |
36
+ | unit | `string` | `undefined` | 否 | 数值单位 | - | - |
37
+
38
+ ## 事件 (Events)
39
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
40
+ | --- | --- | --- | --- | --- |
41
+ | update:modelValue | `@update:modelValue` | 数值变化时触发,可用于实时计算价格、配额或资源总量。 | `value?: number | null` | - |
42
+
43
+ ### 事件参数说明
44
+ **update:modelValue**
45
+
46
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
47
+ | --- | --- | --- | --- | --- |
48
+ | value | `number | null` | 否 | - | 当前数值输入结果。 |
49
+
50
+ ## 使用示例
51
+ ### 带宽数值表单项
52
+ **场景**: 在购买页中配置带宽大小并联动价格。
53
+
54
+ 通过最小值、最大值和单位控制业务数值输入。
55
+
56
+ **使用的 API**: 属性: modelValue, label, min, max, unit | 事件: update:modelValue
57
+
58
+ ```vue
59
+ <script setup lang="ts">
60
+ import { ref } from 'vue';
61
+ import { FormItemSpinner } from '@ksyun-internal/versatile';
62
+
63
+ const bandwidth = ref(20);
64
+ </script>
65
+
66
+ <template>
67
+ <FormItemSpinner
68
+ v-model="bandwidth"
69
+ label="带宽峰值"
70
+ :min="1"
71
+ :max="200"
72
+ unit="Mbps"
73
+ />
74
+ </template>
75
+ ```
76
+
77
+ ### 带精度控制的数值输入
78
+ **场景**: 在高精度资源配置场景中输入支持小数的指标值。
79
+
80
+ 使用 step 和 precision 录入带小数的资源规格。
81
+
82
+ **使用的 API**: 属性: modelValue, label, step, precision, unit
83
+
84
+ ```vue
85
+ <script setup lang="ts">
86
+ import { ref } from 'vue';
87
+ import { FormItemSpinner } from '@ksyun-internal/versatile';
88
+
89
+ const bandwidth = ref(1.5);
90
+ </script>
91
+
92
+ <template>
93
+ <FormItemSpinner
94
+ v-model="bandwidth"
95
+ label="弹性带宽"
96
+ :step="0.5"
97
+ :precision="1"
98
+ unit="Gbps"
99
+ />
100
+ </template>
101
+ ```
102
+
103
+ ## 相关组件
104
+ Spinner, FormItemInput, InstanceNum
105
+
@@ -0,0 +1,113 @@
1
+ # 开关表单项 (FormItemSwitch)
2
+
3
+ 用于业务表单中录入布尔配置的开关表单项组件,补齐了 label、辅助说明和状态切换提示。
4
+
5
+ **关键词**: form item switch, switch item, 开关表单项, 状态开关, 布尔配置
6
+
7
+ **使用场景**: 启停开关、布尔配置项录入、紧凑型开关表单
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { FormItemSwitch } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | trueValue | `any` | `true` | 否 | 开启时的值 | `inherited:Switch` | `<Switch trueValue="on" falseValue="off" />` |
18
+ | falseValue | `any` | `false` | 否 | 关闭时的值 | `inherited:Switch` | `<Switch trueValue="1" falseValue="0" />` |
19
+ | on | `string` | `undefined` | 否 | 开启时显示的文案 | `inherited:Switch` | `<Switch on="开" off="关" />` |
20
+ | off | `string` | `undefined` | 否 | 关闭时显示的文案 | `inherited:Switch` | `<Switch on="ON" off="OFF" />` |
21
+ | disabled | `boolean` | `false` | 否 | 是否禁用 | `inherited:Switch` | `<Switch disabled />` |
22
+ | loading | `boolean` | `false` | 否 | 是否显示加载状态 | `inherited:Switch` | `<Switch :loading="isLoading" />` |
23
+ | size | `"large" | "default" | "small" | "mini"` | `"default"` | 否 | 尺寸 | `inherited:Switch` | `<Switch size="small" />` |
24
+ | width | `number | string` | `undefined` | 否 | 开关的宽度 | `inherited:Switch` | `<Switch :width="60" />` |
25
+ | height | `number | string` | `undefined` | 否 | 开关的高度 | `inherited:Switch` | `<Switch :height="24" />` |
26
+ | name | `string` | `undefined` | 否 | 开关的名称,用于表单提交 | `inherited:Switch` | `<Switch name="enable" />` |
27
+ | beforeChange | `(from: any, to: any) => boolean | Promise<boolean>` | `undefined` | 否 | 切换前的拦截函数,返回 false 阻止切换,支持异步 | `inherited:Switch` | `<Switch :beforeChange="handleBeforeChange" />` |
28
+ | modelValue | `boolean | string` | `undefined` | 否 | 当前开关值 | - | - |
29
+ | hideLabel | `boolean` | `undefined` | 否 | 是否隐藏 label 区域 | - | - |
30
+ | label | `string` | `""` | 否 | 表单项标题 | - | - |
31
+ | tip | `string` | `undefined` | 否 | 辅助提示文案 | - | - |
32
+ | helper | `string` | `undefined` | 否 | 说明文案 | - | - |
33
+ | appendTip | `string` | `undefined` | 否 | 右侧追加提示文案 | - | - |
34
+
35
+ ## 事件 (Events)
36
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
37
+ | --- | --- | --- | --- | --- |
38
+ | update:modelValue | `@update:modelValue` | 开关值变化时触发,适合直接同步布尔型配置。 | `value?: boolean | string` | - |
39
+ | change:value | `@change:value` | 用户完成一次有效切换后触发,可用于触发联动逻辑。 | `value?: boolean | string` | - |
40
+ | change:op | `@change:op` | 组件内部操作态变化时触发,适合跟踪启停类动作的执行过程。 | `value?: string` | - |
41
+
42
+ ### 事件参数说明
43
+ **update:modelValue**
44
+
45
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
46
+ | --- | --- | --- | --- | --- |
47
+ | value | `boolean | string` | 否 | - | 当前开关值,可为布尔值或业务自定义值。 |
48
+
49
+ **change:value**
50
+
51
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
52
+ | --- | --- | --- | --- | --- |
53
+ | value | `boolean | string` | 否 | - | 本次切换后的最终值。 |
54
+
55
+ **change:op**
56
+
57
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
58
+ | --- | --- | --- | --- | --- |
59
+ | value | `string` | 否 | - | 当前操作态标识,例如启用、关闭或处理中等业务态。 |
60
+
61
+ ## 使用示例
62
+ ### 公网访问开关
63
+ **场景**: 在网络配置表单中控制是否开启公网能力。
64
+
65
+ 在表单中配置一个带说明文案的布尔开关项。
66
+
67
+ **使用的 API**: 属性: modelValue, label, helper | 事件: update:modelValue
68
+
69
+ ```vue
70
+ <script setup lang="ts">
71
+ import { ref } from 'vue';
72
+ import { FormItemSwitch } from '@ksyun-internal/versatile';
73
+
74
+ const enablePublicIp = ref(true);
75
+ </script>
76
+
77
+ <template>
78
+ <FormItemSwitch
79
+ v-model="enablePublicIp"
80
+ label="开启公网访问"
81
+ helper="关闭后实例将无法从公网直接访问"
82
+ />
83
+ </template>
84
+ ```
85
+
86
+ ### 隐藏标题的开关项
87
+ **场景**: 在配置卡片中以更紧凑的方式呈现布尔选项。
88
+
89
+ 在紧凑型表单里隐藏 label,仅保留辅助说明。
90
+
91
+ **使用的 API**: 属性: modelValue, hideLabel, helper, appendTip
92
+
93
+ ```vue
94
+ <script setup lang="ts">
95
+ import { ref } from 'vue';
96
+ import { FormItemSwitch } from '@ksyun-internal/versatile';
97
+
98
+ const autoBackup = ref(false);
99
+ </script>
100
+
101
+ <template>
102
+ <FormItemSwitch
103
+ v-model="autoBackup"
104
+ :hide-label="true"
105
+ helper="开启后每天凌晨自动执行备份"
106
+ append-tip="将占用少量存储空间"
107
+ />
108
+ </template>
109
+ ```
110
+
111
+ ## 相关组件
112
+ Switch, FormItemInput
113
+
@@ -0,0 +1,95 @@
1
+ # 表格配置表单项 (FormItemTableConfigs)
2
+
3
+ 通过表格方式维护一组配置项的表单组件,适合批量录入实例规格、节点列表、挂载配置等多行数据。
4
+
5
+ **关键词**: form item table configs, config table form, 配置表格, 实例配置, 批量表单行, 节点配置, 多行表单, 表格型表单项
6
+
7
+ **使用场景**: 多实例配置表单、批量节点配置、确认步骤只读展示配置列表、通过表格维护一组配置项
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { FormItemTableConfigs } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | modelValue | `any[]` | `[]` | 否 | 当前配置项数组 | - | - |
18
+ | label | `string` | `undefined` | 否 | 表单项标题 | - | - |
19
+ | maxInstanceNum | `number` | `undefined` | 否 | 允许添加的最大实例数 | - | - |
20
+ | minInstanceNum | `number` | `1` | 否 | 允许保留的最小实例数 | - | - |
21
+ | initInstanceModels | `() => Record<string, any>` | `undefined` | 是 | 初始化一条实例配置的工厂函数 | - | - |
22
+ | addBtnText | `string` | `undefined` | 否 | 新增按钮文案 | - | - |
23
+ | showAddBtnLabel | `boolean` | `false` | 否 | 是否显示新增按钮标签 | - | - |
24
+ | helper | `string` | `undefined` | 否 | 辅助说明文案 | - | - |
25
+ | info | `string` | `undefined` | 否 | 信息提示文案 | - | - |
26
+ | fixHeader | `number` | `undefined` | 否 | 固定表头高度阈值 | - | - |
27
+ | infinite | `boolean` | `undefined` | 否 | 是否启用无限模式 | - | - |
28
+ | readonly | `boolean` | `undefined` | 否 | 是否为只读模式 | - | - |
29
+
30
+ ## 事件 (Events)
31
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
32
+ | --- | --- | --- | --- | --- |
33
+ | update:modelValue | `@update:modelValue` | 配置项数组变化时触发,新增、删除或编辑行后都会返回最新列表。 | `value?: any[]` | - |
34
+
35
+ ### 事件参数说明
36
+ **update:modelValue**
37
+
38
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
39
+ | --- | --- | --- | --- | --- |
40
+ | value | `any[]` | 否 | - | 当前配置项列表数组。 |
41
+
42
+ ## 使用示例
43
+ ### 节点配置列表维护
44
+ **场景**: 在集群创建页面中维护多条节点或实例配置。
45
+
46
+ 在表单中维护多条节点或实例配置。
47
+
48
+ **使用的 API**: 属性: modelValue, label, addBtnText, maxInstanceNum | 事件: update:modelValue
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import { ref } from 'vue';
53
+ import { FormItemTableConfigs } from '@ksyun-internal/versatile';
54
+
55
+ const nodes = ref([
56
+ { name: 'worker-01', spec: '2C4G' },
57
+ ]);
58
+ </script>
59
+
60
+ <template>
61
+ <FormItemTableConfigs
62
+ v-model="nodes"
63
+ label="节点配置"
64
+ add-btn-text="新增节点"
65
+ :max-instance-num="5"
66
+ />
67
+ </template>
68
+ ```
69
+
70
+ ### 只读模式展示配置列表
71
+ **场景**: 在提交前确认页只读展示用户已填写的表格配置。
72
+
73
+ 在审核或确认步骤中仅展示配置列表,不允许再编辑。
74
+
75
+ **使用的 API**: 属性: modelValue, label, readonly
76
+
77
+ ```vue
78
+ <script setup lang="ts">
79
+ import { ref } from 'vue';
80
+ import { FormItemTableConfigs } from '@ksyun-internal/versatile';
81
+
82
+ const instances = ref([
83
+ { name: 'node-01', spec: '4C8G' },
84
+ { name: 'node-02', spec: '4C8G' },
85
+ ]);
86
+ </script>
87
+
88
+ <template>
89
+ <FormItemTableConfigs v-model="instances" label="实例配置" :readonly="true" />
90
+ </template>
91
+ ```
92
+
93
+ ## 相关组件
94
+ InstanceList, InstanceNum, FormItemInput, FormItemSpinner
95
+
@@ -12,11 +12,11 @@ import { Row, Col } from '@king-design/vue';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | gutter | `string | number | object` | `undefined` | 否 | 栅格间距,单位 px。也可以传入对象设置响应式间距。 | `<Row :gutter="16"></Row>` |
18
- | justify | `"start" | "end" | "center" | "between" | "around" | "evenly"` | `undefined` | 否 | flex 布局下的水平排列方式 | `<Row justify="center"></Row>` |
19
- | align | `"top" | "bottom" | "middle" | "stretch" | "baseline"` | `undefined` | 否 | flex 布局下的垂直对齐方式 | `<Row align="middle"></Row>` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | gutter | `string | number | object` | `undefined` | 否 | 栅格间距,单位 px。也可以传入对象设置响应式间距。 | - | `<Row :gutter="16"></Row>` |
18
+ | justify | `"start" | "end" | "center" | "between" | "around" | "evenly"` | `undefined` | 否 | flex 布局下的水平排列方式 | - | `<Row justify="center"></Row>` |
19
+ | align | `"top" | "bottom" | "middle" | "stretch" | "baseline"` | `undefined` | 否 | flex 布局下的垂直对齐方式 | - | `<Row align="middle"></Row>` |
20
20
 
21
21
  ## 子组件 (Sub-Components)
22
22
  ### Col
@@ -37,6 +37,7 @@ import { Row, Col } from '@king-design/vue';
37
37
  | xxl | `number | string | object` | ≥1600px 响应式栅格 | - |
38
38
 
39
39
  ## 常见错误与正确用法 (Anti-Hallucination)
40
+ ### span 总和超过 24
40
41
  > **错误用法**: `<Row>
41
42
  <Col :span="12">col-12</Col>
42
43
  <Col :span="13">col-13</Col>
@@ -47,6 +48,7 @@ import { Row, Col } from '@king-design/vue';
47
48
  </Row>`
48
49
  > **说明**: Grid 系统基于 24 栅格,一行中的 span 总和(加上 offset)不应超过 24,否则会换行。
49
50
 
51
+ ### gutter 导致的内容溢出
50
52
  > **错误用法**: `<div style="width: 100%; overflow: hidden;">
51
53
  <Row :gutter="20">...</Row>
52
54
  </div>`
@@ -0,0 +1,85 @@
1
+ # 顶部栏 (Header)
2
+
3
+ 页面级顶部栏组件,整合标题、返回、面包屑和文档入口,常用于列表页、详情页以及购买链路页的统一页头。
4
+
5
+ **关键词**: header, page header, 顶部栏, 面包屑, 文档入口
6
+
7
+ **使用场景**: 详情页顶部栏、列表页顶部栏、购买链路页面头部
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Header } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | title | `string` | `""` | 否 | 左侧标题文案 | - | - |
18
+ | back | `() => any | RouteLocationRaw` | `undefined` | 否 | 返回配置,支持函数或路由跳转参数 | - | - |
19
+ | doc | `DocParams` | `undefined` | 否 | 相关文档配置,通常包含中英文文档地址 | - | - |
20
+ | docText | `string` | `"相关文档"` | 否 | 文档入口文案 | - | - |
21
+ | newable | `boolean` | `false` | 否 | 是否启用购买链路顶部栏样式 | - | - |
22
+ | breadcrumb | `Array<{ to: string, label: string }>` | `undefined` | 否 | 面包屑导航配置,元素格式为 { to, label } | - | - |
23
+
24
+ ## 插槽 (Slots)
25
+ | 插槽名 | 说明 | 模板写法 | 示例 |
26
+ | --- | --- | --- | --- |
27
+ | title | 扩展顶部栏左侧标题处内容 | `<template #title>...</template>` | - |
28
+ | titleAppend | 扩展顶部栏左侧标题后的追加内容 | `<template #titleAppend>...</template>` | - |
29
+ | docPrepend | 扩展右侧文档入口前的内容 | `<template #docPrepend>...</template>` | - |
30
+ | doc | 自定义右侧文档区域 | `<template #doc>...</template>` | - |
31
+
32
+ ## 使用示例
33
+ ### 详情页头部信息
34
+ **场景**: 在详情页统一展示返回路径和文档入口。
35
+
36
+ 同时展示标题、面包屑和文档入口,形成统一的页面头部。
37
+
38
+ **使用的 API**: 属性: title, breadcrumb, doc
39
+
40
+ ```vue
41
+ <script setup lang="ts">
42
+ import { Header } from '@ksyun-internal/versatile';
43
+
44
+ const breadcrumb = [
45
+ { to: '/instance', label: '云服务器' },
46
+ { to: '/instance/list', label: '实例列表' },
47
+ { to: '/instance/detail', label: '实例详情' },
48
+ ];
49
+ const doc = {
50
+ zh: 'https://docs.ksyun.com/documents/instance',
51
+ };
52
+ </script>
53
+
54
+ <template>
55
+ <Header title="实例详情" :breadcrumb="breadcrumb" :doc="doc" />
56
+ </template>
57
+ ```
58
+
59
+ ### 通过插槽扩展头部操作
60
+ **场景**: 在页面头部追加状态标识和右侧快捷入口。
61
+
62
+ 使用 titleAppend 和 docPrepend 插槽扩展状态展示和快捷入口。
63
+
64
+ **使用的 API**: 属性: title, docText
65
+
66
+ ```vue
67
+ <script setup lang="ts">
68
+ import { Header } from '@ksyun-internal/versatile';
69
+ </script>
70
+
71
+ <template>
72
+ <Header title="实例详情" doc-text="帮助文档">
73
+ <template #titleAppend>
74
+ <span style="margin-left: 8px; color: #18a058;">运行中</span>
75
+ </template>
76
+ <template #docPrepend>
77
+ <a href="/monitor">监控图表</a>
78
+ </template>
79
+ </Header>
80
+ </template>
81
+ ```
82
+
83
+ ## 相关组件
84
+ LayoutContent, LayoutListContent
85
+