king-design-analyzer 2.1.9 → 2.2.1

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 (327) hide show
  1. package/components/actions.json +109 -0
  2. package/components/advancedset.json +128 -0
  3. package/components/affix.json +8 -0
  4. package/components/aksk.json +172 -0
  5. package/components/anchor.json +220 -0
  6. package/components/anchorlink.json +111 -0
  7. package/components/az.json +15 -2
  8. package/components/badge.json +8 -0
  9. package/components/billtypes.json +14 -2
  10. package/components/breadcrumb.json +9 -1
  11. package/components/button.json +192 -0
  12. package/components/buttonlink.json +74 -0
  13. package/components/card.json +14 -4
  14. package/components/cardcol.json +142 -0
  15. package/components/cardcols.json +121 -0
  16. package/components/cardcontent.json +20 -3
  17. package/components/cardtabs.json +172 -0
  18. package/components/carousel.json +7 -0
  19. package/components/cascader.json +576 -368
  20. package/components/checkbox.json +51 -4
  21. package/components/cidrinput.json +140 -0
  22. package/components/code.json +8 -1
  23. package/components/collapse.json +335 -341
  24. package/components/colorpicker.json +217 -0
  25. package/components/configprovider.json +96 -0
  26. package/components/copy.json +7 -0
  27. package/components/copyhover.json +111 -0
  28. package/components/copyrow.json +125 -0
  29. package/components/datepicker.json +656 -524
  30. package/components/description.json +98 -0
  31. package/components/descriptions.json +10 -3
  32. package/components/diagram.json +295 -0
  33. package/components/dialog.json +526 -455
  34. package/components/divider.json +9 -1
  35. package/components/drawer.json +603 -558
  36. package/components/dropdown.json +464 -384
  37. package/components/duration.json +125 -0
  38. package/components/editable.json +66 -0
  39. package/components/ellipsis.json +34 -1
  40. package/components/filtertablefieldsdialog.json +128 -0
  41. package/components/flex.json +152 -0
  42. package/components/form.json +143 -3
  43. package/components/formiteminput.json +214 -0
  44. package/components/formitemspinner.json +213 -0
  45. package/components/formitemswitch.json +185 -0
  46. package/components/formitemtableconfigs.json +210 -0
  47. package/components/grid.json +7 -0
  48. package/components/header.json +165 -0
  49. package/components/icon.json +13 -1
  50. package/components/icontooltip.json +19 -1
  51. package/components/input.json +196 -8
  52. package/components/instancelist.json +194 -0
  53. package/components/instancenum.json +196 -0
  54. package/components/ipinput.json +117 -0
  55. package/components/kspstatus.json +205 -0
  56. package/components/kvcode.json +120 -0
  57. package/components/layoutcontent.json +24 -3
  58. package/components/layoutlistcontent.json +157 -0
  59. package/components/layoutpermissioncontent.json +156 -0
  60. package/components/layoutstandardlist.json +276 -0
  61. package/components/layouttabs.json +168 -0
  62. package/components/lazymount.json +87 -0
  63. package/components/lazyteleport.json +119 -0
  64. package/components/menu.json +11 -3
  65. package/components/notification.json +351 -0
  66. package/components/pagination.json +12 -0
  67. package/components/paginationplus.json +30 -3
  68. package/components/password.json +121 -0
  69. package/components/popover.json +457 -437
  70. package/components/projects.json +129 -0
  71. package/components/protable.json +99 -8
  72. package/components/queuevisualrange.json +110 -0
  73. package/components/radio.json +82 -2
  74. package/components/rate.json +200 -0
  75. package/components/region.json +14 -2
  76. package/components/scrollselect.json +140 -0
  77. package/components/search.json +221 -0
  78. package/components/searchinput.json +132 -0
  79. package/components/searchitems.json +215 -0
  80. package/components/searchselect.json +195 -0
  81. package/components/select.json +749 -666
  82. package/components/sidebar.json +198 -0
  83. package/components/skeleton.json +234 -0
  84. package/components/slider.json +12 -2
  85. package/components/spin.json +10 -2
  86. package/components/spinner.json +419 -429
  87. package/components/split.json +263 -0
  88. package/components/sshkeys.json +138 -0
  89. package/components/status.json +60 -3
  90. package/components/steps.json +7 -0
  91. package/components/switch.json +12 -3
  92. package/components/table.json +24 -2
  93. package/components/tablecolumnid.json +14 -2
  94. package/components/tabs.json +14 -2
  95. package/components/tag.json +8 -5
  96. package/components/timeline.json +215 -0
  97. package/components/timepicker.json +147 -3
  98. package/components/timerange.json +262 -0
  99. package/components/tip.json +27 -0
  100. package/components/tooltip.json +492 -395
  101. package/components/tour.json +418 -372
  102. package/components/transfer.json +79 -8
  103. package/components/tree.json +28 -5
  104. package/components/treeselect.json +612 -475
  105. package/components/upload.json +474 -473
  106. package/components/vdialog.json +309 -0
  107. package/components/vdrawer.json +335 -0
  108. package/components/virtuallist.json +7 -0
  109. package/dist/ast/index.d.mts +65 -2
  110. package/dist/ast/index.d.ts +65 -2
  111. package/dist/ast/index.js +4 -3
  112. package/dist/ast/index.mjs +2 -1
  113. package/dist/chunk-4OTQAQ6J.mjs +341 -0
  114. package/dist/{chunk-F26GUCGG.js → chunk-4WXOYU2N.js} +32 -9
  115. package/dist/chunk-6HOIRUQB.mjs +409 -0
  116. package/dist/chunk-DHLWNT53.js +364 -0
  117. package/dist/{chunk-H2ET6MMM.mjs → chunk-IPJJMPOO.mjs} +155 -66
  118. package/dist/{chunk-WYSRJVX4.js → chunk-JJ6AB4ZH.js} +2 -2
  119. package/dist/{chunk-2W6OCG2S.js → chunk-JNRGUR3O.js} +155 -67
  120. package/dist/chunk-KF5YBEM5.js +143 -0
  121. package/dist/{chunk-OJOHB64C.mjs → chunk-LRTDTFFQ.mjs} +28 -5
  122. package/dist/{chunk-DSWKLUIX.mjs → chunk-NZL6T22V.mjs} +1 -1
  123. package/dist/chunk-QC6VTSA3.mjs +117 -0
  124. package/dist/chunk-V5N65MRP.js +411 -0
  125. package/dist/full/index.d.mts +2 -0
  126. package/dist/full/index.d.ts +2 -0
  127. package/dist/full/index.js +7 -6
  128. package/dist/full/index.mjs +5 -4
  129. package/dist/index.d.mts +1 -0
  130. package/dist/index.d.ts +1 -0
  131. package/dist/index.js +14 -13
  132. package/dist/index.mjs +6 -5
  133. package/dist/metadata/index.d.mts +38 -3
  134. package/dist/metadata/index.d.ts +38 -3
  135. package/dist/metadata/index.js +26 -16
  136. package/dist/metadata/index.mjs +26 -15
  137. package/dist/resolve-BsLBxlBi.d.mts +24 -0
  138. package/dist/resolve-BsLBxlBi.d.ts +24 -0
  139. package/dist/runtime/index.d.mts +2 -0
  140. package/dist/runtime/index.d.ts +2 -0
  141. package/dist/runtime/index.js +4 -4
  142. package/dist/runtime/index.mjs +2 -2
  143. package/dist/shared/index.d.mts +10 -0
  144. package/dist/shared/index.d.ts +10 -0
  145. package/dist/shared/index.js +23 -0
  146. package/dist/shared/index.mjs +2 -0
  147. package/dist/static/index.js +5 -5
  148. package/dist/static/index.mjs +2 -2
  149. package/docs_for_llm/actions.doc.md +87 -0
  150. package/docs_for_llm/advancedset.doc.md +98 -0
  151. package/docs_for_llm/affix.doc.md +20 -7
  152. package/docs_for_llm/aksk.doc.md +111 -0
  153. package/docs_for_llm/anchor.doc.md +155 -0
  154. package/docs_for_llm/anchorlink.doc.md +75 -0
  155. package/docs_for_llm/az.doc.md +17 -11
  156. package/docs_for_llm/badge.doc.md +11 -5
  157. package/docs_for_llm/billtypes.doc.md +17 -11
  158. package/docs_for_llm/breadcrumb.doc.md +80 -4
  159. package/docs_for_llm/button.doc.md +91 -18
  160. package/docs_for_llm/buttonlink.doc.md +64 -0
  161. package/docs_for_llm/card.doc.md +58 -8
  162. package/docs_for_llm/cardcol.doc.md +78 -0
  163. package/docs_for_llm/cardcols.doc.md +84 -0
  164. package/docs_for_llm/cardcontent.doc.md +31 -10
  165. package/docs_for_llm/cardtabs.doc.md +106 -0
  166. package/docs_for_llm/carousel.doc.md +79 -7
  167. package/docs_for_llm/cascader.doc.md +106 -23
  168. package/docs_for_llm/checkbox.doc.md +25 -13
  169. package/docs_for_llm/cidrinput.doc.md +83 -0
  170. package/docs_for_llm/code.doc.md +22 -11
  171. package/docs_for_llm/collapse.doc.md +147 -14
  172. package/docs_for_llm/colorpicker.doc.md +104 -0
  173. package/docs_for_llm/configprovider.doc.md +77 -0
  174. package/docs_for_llm/copy.doc.md +15 -13
  175. package/docs_for_llm/copyhover.doc.md +59 -0
  176. package/docs_for_llm/copyrow.doc.md +80 -0
  177. package/docs_for_llm/datepicker.doc.md +66 -35
  178. package/docs_for_llm/description.doc.md +75 -0
  179. package/docs_for_llm/descriptions.doc.md +122 -10
  180. package/docs_for_llm/diagram.doc.md +343 -0
  181. package/docs_for_llm/dialog.doc.md +97 -77
  182. package/docs_for_llm/divider.doc.md +14 -7
  183. package/docs_for_llm/drawer.doc.md +114 -69
  184. package/docs_for_llm/dropdown.doc.md +290 -22
  185. package/docs_for_llm/duration.doc.md +76 -0
  186. package/docs_for_llm/editable.doc.md +36 -14
  187. package/docs_for_llm/ellipsis.doc.md +10 -5
  188. package/docs_for_llm/filtertablefieldsdialog.doc.md +99 -0
  189. package/docs_for_llm/flex.doc.md +83 -0
  190. package/docs_for_llm/form.doc.md +196 -18
  191. package/docs_for_llm/formiteminput.doc.md +128 -0
  192. package/docs_for_llm/formitemspinner.doc.md +105 -0
  193. package/docs_for_llm/formitemswitch.doc.md +113 -0
  194. package/docs_for_llm/formitemtableconfigs.doc.md +95 -0
  195. package/docs_for_llm/grid.doc.md +78 -5
  196. package/docs_for_llm/header.doc.md +114 -0
  197. package/docs_for_llm/icon.doc.md +12 -8
  198. package/docs_for_llm/icontooltip.doc.md +121 -0
  199. package/docs_for_llm/input.doc.md +199 -41
  200. package/docs_for_llm/instancelist.doc.md +113 -0
  201. package/docs_for_llm/instancenum.doc.md +95 -0
  202. package/docs_for_llm/ipinput.doc.md +77 -0
  203. package/docs_for_llm/kspstatus.doc.md +82 -0
  204. package/docs_for_llm/kvcode.doc.md +76 -0
  205. package/docs_for_llm/layoutcontent.doc.md +54 -17
  206. package/docs_for_llm/layoutlistcontent.doc.md +168 -0
  207. package/docs_for_llm/layoutpermissioncontent.doc.md +93 -0
  208. package/docs_for_llm/layoutstandardlist.doc.md +129 -0
  209. package/docs_for_llm/layouttabs.doc.md +101 -0
  210. package/docs_for_llm/lazymount.doc.md +82 -0
  211. package/docs_for_llm/lazyteleport.doc.md +85 -0
  212. package/docs_for_llm/menu.doc.md +139 -14
  213. package/docs_for_llm/message.doc.md +93 -10
  214. package/docs_for_llm/notification.doc.md +214 -0
  215. package/docs_for_llm/pagination.doc.md +30 -17
  216. package/docs_for_llm/paginationplus.doc.md +31 -10
  217. package/docs_for_llm/password.doc.md +86 -0
  218. package/docs_for_llm/popover.doc.md +24 -55
  219. package/docs_for_llm/progress.doc.md +13 -10
  220. package/docs_for_llm/projects.doc.md +91 -0
  221. package/docs_for_llm/protable.doc.md +98 -15
  222. package/docs_for_llm/queuevisualrange.doc.md +78 -0
  223. package/docs_for_llm/radio.doc.md +23 -8
  224. package/docs_for_llm/rate.doc.md +127 -0
  225. package/docs_for_llm/region.doc.md +25 -13
  226. package/docs_for_llm/scrollselect.doc.md +90 -0
  227. package/docs_for_llm/search.doc.md +120 -0
  228. package/docs_for_llm/searchinput.doc.md +111 -0
  229. package/docs_for_llm/searchitems.doc.md +116 -0
  230. package/docs_for_llm/searchselect.doc.md +126 -0
  231. package/docs_for_llm/select.doc.md +208 -49
  232. package/docs_for_llm/sidebar.doc.md +133 -0
  233. package/docs_for_llm/skeleton.doc.md +152 -0
  234. package/docs_for_llm/slider.doc.md +42 -22
  235. package/docs_for_llm/spin.doc.md +18 -6
  236. package/docs_for_llm/spinner.doc.md +28 -18
  237. package/docs_for_llm/split.doc.md +170 -0
  238. package/docs_for_llm/sshkeys.doc.md +88 -0
  239. package/docs_for_llm/status.doc.md +14 -9
  240. package/docs_for_llm/steps.doc.md +81 -7
  241. package/docs_for_llm/switch.doc.md +32 -16
  242. package/docs_for_llm/table.doc.md +317 -55
  243. package/docs_for_llm/tablecolumnid.doc.md +36 -16
  244. package/docs_for_llm/tabs.doc.md +117 -12
  245. package/docs_for_llm/tag.doc.md +167 -15
  246. package/docs_for_llm/timeline.doc.md +187 -0
  247. package/docs_for_llm/timepicker.doc.md +74 -36
  248. package/docs_for_llm/timerange.doc.md +157 -0
  249. package/docs_for_llm/tip.doc.md +50 -11
  250. package/docs_for_llm/tooltip.doc.md +99 -27
  251. package/docs_for_llm/tour.doc.md +125 -28
  252. package/docs_for_llm/transfer.doc.md +99 -33
  253. package/docs_for_llm/tree.doc.md +129 -24
  254. package/docs_for_llm/treeselect.doc.md +101 -44
  255. package/docs_for_llm/upload.doc.md +63 -32
  256. package/docs_for_llm/useCRUD.doc.md +49 -0
  257. package/docs_for_llm/useCountdown.doc.md +43 -0
  258. package/docs_for_llm/useDetail.doc.md +48 -0
  259. package/docs_for_llm/useDialog.doc.md +46 -0
  260. package/docs_for_llm/useEntity.doc.md +45 -0
  261. package/docs_for_llm/useEventListener.doc.md +44 -0
  262. package/docs_for_llm/useFalseUntilTruthy.doc.md +41 -0
  263. package/docs_for_llm/useGetCopyAuthText.doc.md +35 -0
  264. package/docs_for_llm/useGetUserPermission.doc.md +43 -0
  265. package/docs_for_llm/useGroup.doc.md +48 -0
  266. package/docs_for_llm/useIdEntities.doc.md +48 -0
  267. package/docs_for_llm/useIdEntity.doc.md +103 -0
  268. package/docs_for_llm/useInterval.doc.md +43 -0
  269. package/docs_for_llm/useLayoutStandardList.doc.md +38 -0
  270. package/docs_for_llm/useMessage.doc.md +46 -0
  271. package/docs_for_llm/useModifyCache.doc.md +37 -0
  272. package/docs_for_llm/useOpenDialog.doc.md +41 -0
  273. package/docs_for_llm/usePagination.doc.md +60 -0
  274. package/docs_for_llm/usePersist.doc.md +54 -0
  275. package/docs_for_llm/usePoll.doc.md +41 -0
  276. package/docs_for_llm/useRoutePlus.doc.md +34 -0
  277. package/docs_for_llm/useRouterPlus.doc.md +34 -0
  278. package/docs_for_llm/useSearch.doc.md +68 -0
  279. package/docs_for_llm/useShell.doc.md +43 -0
  280. package/docs_for_llm/useSkip.doc.md +41 -0
  281. package/docs_for_llm/useStorageIdEntity.doc.md +46 -0
  282. package/docs_for_llm/useStore.doc.md +34 -0
  283. package/docs_for_llm/useTable.doc.md +57 -0
  284. package/docs_for_llm/useTableGroup.doc.md +47 -0
  285. package/docs_for_llm/useTableSort.doc.md +40 -0
  286. package/docs_for_llm/useToState.doc.md +112 -0
  287. package/docs_for_llm/useUser.doc.md +38 -0
  288. package/docs_for_llm/useValidForm.doc.md +41 -0
  289. package/docs_for_llm/vdialog.doc.md +154 -0
  290. package/docs_for_llm/vdrawer.doc.md +148 -0
  291. package/docs_for_llm/virtuallist.doc.md +157 -3
  292. package/hooks/useCRUD.json +61 -0
  293. package/hooks/useCountdown.json +49 -0
  294. package/hooks/useDetail.json +67 -0
  295. package/hooks/useDialog.json +49 -0
  296. package/hooks/useEntity.json +61 -0
  297. package/hooks/useEventListener.json +61 -0
  298. package/hooks/useFalseUntilTruthy.json +43 -0
  299. package/hooks/useGetCopyAuthText.json +36 -0
  300. package/hooks/useGetUserPermission.json +55 -0
  301. package/hooks/useGroup.json +49 -0
  302. package/hooks/useIdEntities.json +61 -0
  303. package/hooks/useInterval.json +55 -0
  304. package/hooks/useLayoutStandardList.json +36 -0
  305. package/hooks/useMessage.json +73 -0
  306. package/hooks/useModifyCache.json +36 -0
  307. package/hooks/useOpenDialog.json +43 -0
  308. package/hooks/usePagination.json +49 -0
  309. package/hooks/usePersist.json +61 -0
  310. package/hooks/usePoll.json +43 -0
  311. package/hooks/useRoutePlus.json +36 -0
  312. package/hooks/useRouterPlus.json +36 -0
  313. package/hooks/useSearch.json +56 -0
  314. package/hooks/useShell.json +49 -0
  315. package/hooks/useSkip.json +43 -0
  316. package/hooks/useStorageIdEntity.json +67 -0
  317. package/hooks/useStore.json +36 -0
  318. package/hooks/useTable.json +49 -0
  319. package/hooks/useTableGroup.json +43 -0
  320. package/hooks/useTableSort.json +43 -0
  321. package/hooks/useUser.json +36 -0
  322. package/hooks/useValidForm.json +43 -0
  323. package/package.json +14 -8
  324. package/dist/chunk-D3Y6FGWA.js +0 -153
  325. package/dist/chunk-HPAUCD5I.js +0 -156
  326. package/dist/chunk-L4DS3EXI.mjs +0 -133
  327. package/dist/chunk-NZ6TLWMD.mjs +0 -151
@@ -12,17 +12,23 @@ import { Editable } from '@king-design/vue';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | value | `string` | `undefined` | 否 | 编辑的内容,可用 v-model 双向绑定 | `<Editable v-model="text" />` |
18
- | editing | `boolean` | `false` | 否 | 是否为编辑状态 | `<Editable :editing="isEditing" />` |
19
- | required | `boolean` | `true` | 否 | 是否规定不能为空 | `<Editable :required="false" />` |
20
- | validate | `((v: string) => boolean) | RegExp | string` | `undefined` | 否 | 验证规则,支持函数、正则表达式或正则字符串。函数返回 true 表示验证通过 | `<Editable :validate="(v) => v.length >= 3" /></Editable>` |
21
- | disabled | `boolean` | `false` | 否 | 是否禁用编辑 | `<Editable disabled />` |
22
- | tip | `string` | `"编辑"` | 否 | 编辑按钮提示文案 | `<Editable tip="点击修改" />` |
23
- | trim | `boolean` | `true` | 否 | 是否去掉前后空白字符 | `<Editable :trim="false" />` |
24
- | invalid | `boolean` | `false` | 否 | 是否为验证失败状态 | `<Editable :invalid="hasError" />` |
25
- | rows | `string | number | 'auto' | AutoRows` | `1` | 否 | 是否自动折行及行数控制,可为数字、'auto' 或包含 min/max 的对象 | `<Editable :rows="3" />` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | value | `string` | `undefined` | 否 | 编辑的内容,可用 v-model 双向绑定 | - | `<Editable v-model="text" />` |
18
+ | editing | `boolean` | `false` | 否 | 是否为编辑状态 | - | `<Editable :editing="isEditing" />` |
19
+ | required | `boolean` | `true` | 否 | 是否规定不能为空 | - | `<Editable :required="false" />` |
20
+ | validate | `((v: string) => boolean) | RegExp | string` | `undefined` | 否 | 验证规则,支持函数、正则表达式或正则字符串。函数返回 true 表示验证通过 | - | `<Editable :validate="(v) => v.length >= 3" /></Editable>` |
21
+ | disabled | `boolean` | `false` | 否 | 是否禁用编辑 | - | `<Editable disabled />` |
22
+ | placeholder | `string` | `undefined` | 否 | 编辑态输入框的占位提示文本 | - | `<Editable placeholder="请输入内容" />` |
23
+ | title | `string` | `"编辑"` | 否 | 编辑按钮或输入区域的标题提示文本 | - | `<Editable title="修改名称" />` |
24
+ | tip | `string` | `"编辑"` | 否 | 编辑按钮提示文案 | - | `<Editable tip="点击修改" />` |
25
+ | trim | `boolean` | `true` | 否 | 是否去掉前后空白字符 | - | `<Editable :trim="false" />` |
26
+ | invalid | `boolean` | `false` | 否 | 是否为验证失败状态 | - | `<Editable :invalid="hasError" />` |
27
+ | errorTip | `string` | `"输入有误"` | 否 | 验证失败时显示的错误提示文案 | - | `<Editable error-tip="名称格式不正确" />` |
28
+ | okText | `string` | `"确定"` | 否 | 确认按钮文案 | - | `<Editable ok-text="保存" />` |
29
+ | cancelText | `string` | `"取消"` | 否 | 取消按钮文案 | - | `<Editable cancel-text="放弃" />` |
30
+ | type | `string` | `undefined` | 否 | 编辑输入框类型,通常用于切换单行或其他输入模式 | - | `<Editable type="textarea" />` |
31
+ | rows | `string | number | 'auto' | AutoRows` | `1` | 否 | 是否自动折行及行数控制,可为数字、'auto' 或包含 min/max 的对象 | - | `<Editable :rows="3" />` |
26
32
 
27
33
  ## 事件 (Events)
28
34
  | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
@@ -30,15 +36,28 @@ import { Editable } from '@king-design/vue';
30
36
  | change | `@change` | 当值改变时触发 | `newValue: string, oldValue: string` | `<Editable @change="handleChange" />` |
31
37
  | error | `@error` | 验证失败时触发 | `value: string` | `<Editable @error="handleError" />` |
32
38
 
33
- ### 事件处理函数示例
34
- **change**:
39
+ ### 事件参数说明
40
+ **change**
41
+
42
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
43
+ | --- | --- | --- | --- | --- |
44
+ | newValue | `string` | 是 | - | 新的值 |
45
+ | oldValue | `string` | 是 | - | 旧的值 |
46
+
47
+ 事件处理示例:
35
48
  ```typescript
36
49
  const handleChange = (newValue: string, oldValue: string) => {
37
50
  console.log(`值从 ${oldValue} 变为 ${newValue}`);
38
51
  };
39
52
  ```
40
53
 
41
- **error**:
54
+ **error**
55
+
56
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
57
+ | --- | --- | --- | --- | --- |
58
+ | value | `string` | 是 | - | 验证失败的值 |
59
+
60
+ 事件处理示例:
42
61
  ```typescript
43
62
  const handleError = (value: string) => {
44
63
  Message.error(`验证失败: ${value}`);
@@ -46,6 +65,7 @@ const handleError = (value: string) => {
46
65
  ```
47
66
 
48
67
  ## 常见错误与正确用法 (Anti-Hallucination)
68
+ ### 验证函数返回值错误
49
69
  > **错误用法**: `const validate = (v: string) => {
50
70
  if (v.length < 3) {
51
71
  return '长度不能小于3';
@@ -56,10 +76,12 @@ const handleError = (value: string) => {
56
76
  }`
57
77
  > **说明**: validate 函数应返回布尔值,true 表示验证通过,false 表示失败
58
78
 
79
+ ### rows 值类型错误
59
80
  > **错误用法**: `<Editable rows="3" />`
60
81
  > **正确写法**: `<Editable :rows="3" />`
61
82
  > **说明**: 当 rows 为数字时需要使用 v-bind (:rows),字符串 '3' 会被当作字符串处理
62
83
 
84
+ ### 不了解 required 默认为 true
63
85
  > **错误用法**: `<Editable v-model="text" /> <!-- 用户无法保存空值 -->`
64
86
  > **正确写法**: `<Editable v-model="text" :required="false" /> <!-- 允许空值 -->`
65
87
  > **说明**: Editable 默认 required 为 true,如果允许空值需要显式设置 :required="false"
@@ -12,23 +12,28 @@ import { Ellipsis } from '@king-design/vue';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | maxLines | `number` | `undefined` | 否 | 定义多行省略最大行数,不设置时为单行省略 | `<Ellipsis :maxLines="2">长文本内容</Ellipsis>` |
18
- | position | `Position | "left" | "bottom" | "right" | "top"` | `{my: 'center bottom-10', at: 'center top', collision: 'flipfit'}` | 否 | Tooltip 弹出的位置,默认在触发器正上方向上偏移 10px | `<Ellipsis position="bottom">长文本</Ellipsis>` |
19
- | disabled | `boolean` | `false` | 否 | 是否禁用 Tooltip 提示(禁用后悬停不会显示完整内容) | `<Ellipsis disabled>长文本</Ellipsis>` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | maxLines | `number` | `undefined` | 否 | 定义多行省略最大行数,不设置时为单行省略 | - | `<Ellipsis :maxLines="2">长文本内容</Ellipsis>` |
18
+ | position | `Position | "left" | "bottom" | "right" | "top"` | `{my: 'center bottom-10', at: 'center top', collision: 'flipfit'}` | 否 | Tooltip 弹出的位置,默认在触发器正上方向上偏移 10px | - | `<Ellipsis position="bottom">长文本</Ellipsis>` |
19
+ | theme | `"dark" | "light"` | `"light"` | 否 | Tooltip 主题 | - | `<Ellipsis theme="dark">长文本</Ellipsis>` |
20
+ | hoverable | `boolean` | `false` | 否 | 悬浮提示层是否在鼠标移入 Tooltip 内容时仍然保持显示 | - | `<Ellipsis hoverable>长文本</Ellipsis>` |
21
+ | disabled | `boolean` | `false` | 否 | 是否禁用 Tooltip 提示(禁用后悬停不会显示完整内容) | - | `<Ellipsis disabled>长文本</Ellipsis>` |
20
22
 
21
23
  ## 常见错误与正确用法 (Anti-Hallucination)
24
+ ### 容器未设置宽度
22
25
  > **错误用法**: `<Ellipsis>长文本内容</Ellipsis>`
23
26
  > **正确写法**: `<div style="width: 200px;">
24
27
  <Ellipsis>长文本内容</Ellipsis>
25
28
  </div>`
26
29
  > **说明**: Ellipsis 需要父容器有明确的宽度限制才能生效
27
30
 
31
+ ### maxLines 使用字符串而非数字
28
32
  > **错误用法**: `<Ellipsis maxLines="2">文本</Ellipsis>`
29
33
  > **正确写法**: `<Ellipsis :maxLines="2">文本</Ellipsis>`
30
34
  > **说明**: maxLines 是数字类型,需要使用 v-bind 语法
31
35
 
36
+ ### 误解 disabled 属性的含义
32
37
  > **错误用法**: `<Ellipsis disabled> <!-- 以为会禁用省略效果 -->`
33
38
  > **正确写法**: `<Ellipsis disabled> <!-- 实际是禁用 Tooltip,省略效果仍然存在 -->`
34
39
  > **说明**: disabled 只是禁用悬停时的 Tooltip 提示,文本省略效果仍然生效
@@ -0,0 +1,99 @@
1
+ # 表格字段筛选弹窗 (FilterTableFieldsDialog)
2
+
3
+ 用于自定义表格可见列的配置弹窗,常与 ProTable、标准列表页联动,让用户自行决定展示哪些字段。
4
+
5
+ **关键词**: filter table fields dialog, column settings, 列筛选弹窗, 字段配置, 列展示设置, column chooser, 表格列管理, 隐藏列
6
+
7
+ **使用场景**: 表格字段自定义、列表列设置、列显示偏好持久化、用户自定义列表展示字段
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { FilterTableFieldsDialog } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | modelValue | `boolean` | `undefined` | 否 | 弹窗显示状态 | - | - |
18
+ | fields | `TableFieldItem[]` | `undefined` | 是 | 可配置字段列表 | - | - |
19
+
20
+ ## 事件 (Events)
21
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
22
+ | --- | --- | --- | --- | --- |
23
+ | update:modelValue | `@update:modelValue` | 弹窗开关状态变化时触发,用于控制列设置面板显隐。 | `value?: boolean` | - |
24
+ | change:noCheckedColFields | `@change:noCheckedColFields` | 未勾选列集合变化时触发,便于把列配置持久化到本地或服务端。 | `value?: string[]` | - |
25
+
26
+ ### 事件参数说明
27
+ **update:modelValue**
28
+
29
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
30
+ | --- | --- | --- | --- | --- |
31
+ | value | `boolean` | 否 | - | 当前列设置弹窗是否显示。 |
32
+
33
+ **change:noCheckedColFields**
34
+
35
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
36
+ | --- | --- | --- | --- | --- |
37
+ | value | `string[]` | 否 | - | 当前未勾选字段的 key 列表。 |
38
+
39
+ ## 使用示例
40
+ ### 列表列展示配置
41
+ **场景**: 让用户自主配置列表页中要显示的列。
42
+
43
+ 通过字段列表控制表格哪些列默认展示。
44
+
45
+ **使用的 API**: 属性: modelValue, fields | 事件: update:modelValue, change:noCheckedColFields
46
+
47
+ ```vue
48
+ <script setup lang="ts">
49
+ import { ref } from 'vue';
50
+ import { FilterTableFieldsDialog } from '@ksyun-internal/versatile';
51
+
52
+ const visible = ref(true);
53
+ const fields = [
54
+ { key: 'id', label: '实例 ID', checked: true },
55
+ { key: 'name', label: '实例名称', checked: true },
56
+ { key: 'privateIp', label: '内网 IP', checked: false },
57
+ ];
58
+ </script>
59
+
60
+ <template>
61
+ <FilterTableFieldsDialog v-model="visible" :fields="fields" />
62
+ </template>
63
+ ```
64
+
65
+ ### 持久化隐藏列配置
66
+ **场景**: 让用户的列显示偏好在刷新页面后仍然保留。
67
+
68
+ 监听未勾选字段变化并保存到本地缓存。
69
+
70
+ **使用的 API**: 属性: modelValue, fields | 事件: change:noCheckedColFields
71
+
72
+ ```vue
73
+ <script setup lang="ts">
74
+ import { ref } from 'vue';
75
+ import { FilterTableFieldsDialog } from '@ksyun-internal/versatile';
76
+
77
+ const visible = ref(true);
78
+ const fields = [
79
+ { key: 'id', label: '实例 ID', checked: true },
80
+ { key: 'zone', label: '可用区', checked: true },
81
+ { key: 'privateIp', label: '内网 IP', checked: false },
82
+ ];
83
+ const handleChange = (hiddenFields: string[]) => {
84
+ localStorage.setItem('instance-hidden-fields', JSON.stringify(hiddenFields));
85
+ };
86
+ </script>
87
+
88
+ <template>
89
+ <FilterTableFieldsDialog
90
+ v-model="visible"
91
+ :fields="fields"
92
+ @change:noCheckedColFields="handleChange"
93
+ />
94
+ </template>
95
+ ```
96
+
97
+ ## 相关组件
98
+ ProTable, LayoutStandardList
99
+
@@ -0,0 +1,83 @@
1
+ # 弹性布局 (Flex)
2
+
3
+ 对 Flexbox 的业务友好封装,适合快速实现工具栏、卡片头部、表单辅助区等横向或纵向弹性布局。
4
+
5
+ **关键词**: flex, layout, 弹性布局, 对齐, gap
6
+
7
+ **使用场景**: 工具栏布局、信息块横向或纵向排列、纵向摘要区排版
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Flex } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | align | `'normal' | 'flex-start' | 'flex-end' | 'center' | 'baseline' | 'stretch'` | `'normal'` | 否 | 交叉轴对齐方式 | - | - |
18
+ | justify | `'normal' | 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around'` | `'normal'` | 否 | 主轴对齐方式 | - | - |
19
+ | wrap | `'nowrap' | 'wrap' | 'wrap-reverse' | boolean` | `'nowrap'` | 否 | 换行方式 | - | - |
20
+ | inline | `boolean` | `false` | 否 | 是否以行内 flex 容器渲染 | - | - |
21
+ | vertical | `boolean` | `false` | 否 | 是否启用纵向布局 | - | - |
22
+ | gap | `'small' | 'middle' | 'large' | string` | `'small'` | 否 | 子元素间距,支持预设值或自定义字符串 | - | - |
23
+ | component | `string | Component` | `'div'` | 否 | 容器渲染的标签或组件类型 | - | - |
24
+
25
+ ## 插槽 (Slots)
26
+ | 插槽名 | 说明 | 模板写法 | 示例 |
27
+ | --- | --- | --- | --- |
28
+ | default | Flex 容器内容 | `<Flex>...</Flex>` | `<Flex>
29
+ <template <Flex>...</Flex>>
30
+ 自定义default内容
31
+ </template>
32
+ </Flex>` |
33
+
34
+ ### 插槽参数说明
35
+ **default**
36
+
37
+ - 参数结构: 无参数
38
+
39
+ ## 使用示例
40
+ ### 工具栏左右分布布局
41
+ **场景**: 搭建列表页顶部的标题和操作区。
42
+
43
+ 用 Flex 快速搭建常见的左右两端对齐工具栏。
44
+
45
+ **使用的 API**: 属性: justify, align, gap
46
+
47
+ ```vue
48
+ <script setup lang="ts">
49
+ import { Flex } from '@ksyun-internal/versatile';
50
+ </script>
51
+
52
+ <template>
53
+ <Flex justify="space-between" align="center" gap="middle">
54
+ <div>实例列表</div>
55
+ <div>刷新 / 导出 / 新建</div>
56
+ </Flex>
57
+ </template>
58
+ ```
59
+
60
+ ### 纵向信息堆叠
61
+ **场景**: 在详情摘要区纵向排列多条关键信息。
62
+
63
+ 使用 vertical 和 gap 快速搭建纵向信息区。
64
+
65
+ **使用的 API**: 属性: vertical, gap
66
+
67
+ ```vue
68
+ <script setup lang="ts">
69
+ import { Flex } from '@ksyun-internal/versatile';
70
+ </script>
71
+
72
+ <template>
73
+ <Flex vertical gap="large">
74
+ <div>实例规格:4C8G</div>
75
+ <div>系统盘:100GB SSD</div>
76
+ <div>网络:经典网络</div>
77
+ </Flex>
78
+ </template>
79
+ ```
80
+
81
+ ## 相关组件
82
+ LayoutContent, LayoutListContent
83
+
@@ -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,15 +50,48 @@ 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[]` |
57
+
58
+ ### 方法调用示例
59
+ **validate**
60
+
61
+ ```typescript
62
+ const formRef = ref<InstanceType<typeof Form>>();
63
+
64
+ const handleSubmit = async () => {
65
+ const valid = await formRef.value?.validate();
66
+ if (valid) {
67
+ console.log('验证通过');
68
+ }
69
+ };</InstanceType>
70
+ ```
71
+
72
+ **reset**
73
+
74
+ ```typescript
75
+ formRef.value?.reset();
76
+ ```
77
+
78
+ **getFirstInvalidFormItem**
79
+
80
+ ```typescript
81
+ const firstError = formRef.value?.getFirstInvalidFormItem();
82
+ ```
83
+
84
+ **getAllInvalidFormItems**
85
+
86
+ ```typescript
87
+ const allErrors = formRef.value?.getAllInvalidFormItems();
88
+ ```
42
89
 
43
90
  ## 子组件 (Sub-Components)
44
91
  ### FormItem
45
92
  表单项组件,用于包裹表单控件并提供验证功能
46
93
 
94
+ #### 属性 (Props)
47
95
  | 属性名 | 类型 | 说明 | 示例 |
48
96
  | --- | --- | --- | --- |
49
97
  | value | `any` | 指定需要验证的数据 | `<FormItem :value="model.username" :rules="{required: true}"></FormItem>` |
@@ -57,12 +105,139 @@ const handleSubmit = (e: Event) => {
57
105
  | fluid | `boolean` | FormItem 的宽度默认是被子元素撑开的,添加该属性可以渲染 100% 的宽度 | `<FormItem fluid></FormItem>` |
58
106
  | validateOnStart | `boolean` | 是否组件一渲染就开始验证,而不是等用户输入完成再验证 | `<FormItem validateOnStart></FormItem>` |
59
107
 
60
- **插槽**:
61
- - `undefined`: 扩展前面的标题label
62
- - `undefined`: 扩展后面的内容,也可以使用children代替
63
- - `undefined`: 往后面追加的内容
108
+ #### 插槽 (Slots)
109
+ | 插槽名 | 说明 | 模板写法 | 示例 |
110
+ | --- | --- | --- | --- |
111
+ | label | 扩展前面的标题label | `#label` | `<FormItem>
112
+ <template #label>
113
+ 用户名
114
+ </template>
115
+ <Input />
116
+ </FormItem>` |
117
+ | content | 扩展后面的内容,也可以使用children代替 | `#content` | `<FormItem label="用户名">
118
+ <template #content>
119
+ <Input />
120
+ </template>
121
+ </FormItem>` |
122
+ | append | 往后面追加的内容 | `#append` | `<FormItem label="验证码">
123
+ <Input />
124
+ <template #append>
125
+ <Button type="primary">发送验证码</Button>
126
+ </template>
127
+ </FormItem>` |
128
+
129
+ ##### 插槽参数说明
130
+ **label**
131
+
132
+ - 参数结构: 无参数
133
+
134
+ **content**
135
+
136
+ - 参数结构: 无参数
137
+
138
+ **append**
139
+
140
+ - 参数结构: 无参数
141
+
142
+ #### 组合示例
143
+ ##### 自定义错误提示
144
+ **场景**: 自定义表单验证失败时显示的错误提示文案
145
+
146
+ 自定义验证失败时的错误提示文案
147
+
148
+ **命中的子组件 API**: 属性: value, rules, messages, label
149
+
150
+ ```vue
151
+ <script setup lang="ts">
152
+ import { reactive } from 'vue';
153
+ import { Form, FormItem, Input } from '@king-design/vue';
154
+
155
+ const model = reactive({
156
+ email: ''
157
+ });
158
+ </script>
159
+ <template>
160
+ <Form>
161
+ <FormItem label="邮箱" :value="model.email"
162
+ :rules="{required: true, email: true}"
163
+ :messages="{required: '邮箱不能为空', email: '邮箱格式不正确'}">
164
+ <Input v-model="model.email" />
165
+ </FormItem>
166
+ </Form>
167
+ </template>
168
+ ```
169
+
170
+ ##### 基础表单验证
171
+ **场景**: 创建一个带有用户名和邮箱验证的基础表单
172
+
173
+ 基本的表单验证用法
174
+
175
+ **命中的子组件 API**: 属性: value, rules, label
176
+
177
+ ```vue
178
+ <script setup lang="ts">
179
+ import { ref, reactive } from 'vue';
180
+ import { Form, FormItem, Input, Button, Message } from '@king-design/vue';
181
+
182
+ const form = ref<InstanceType<typeof Form>>();
183
+ const model = reactive({
184
+ username: '',
185
+ email: ''
186
+ });
187
+
188
+ const handleSubmit = async () => {
189
+ if (await form.value?.validate()) {
190
+ Message.success('验证通过');
191
+ }
192
+ };
193
+ </script>
194
+ <template>
195
+ <Form ref="form" @submit="handleSubmit">
196
+ <FormItem label="用户名" :value="model.username" :rules="{required: true}">
197
+ <Input v-model="model.username" />
198
+ </FormItem>
199
+ <FormItem label="邮箱" :value="model.email" :rules="{required: true, email: true}">
200
+ <Input v-model="model.email" />
201
+ </FormItem>
202
+ <FormItem>
203
+ <Button type="primary" htmlType="submit">提交</Button>
204
+ </FormItem>
205
+ </Form>
206
+ </template>
207
+ ```
208
+
209
+ ##### 密码确认验证
210
+ **场景**: 创建密码和确认密码字段,验证两次输入是否一致
211
+
212
+ 使用 equal 规则实现密码确认
213
+
214
+ **命中的子组件 API**: 属性: value, rules, label
215
+
216
+ ```vue
217
+ <script setup lang="ts">
218
+ import { reactive } from 'vue';
219
+ import { Form, FormItem, Input } from '@king-design/vue';
220
+
221
+ const model = reactive({
222
+ password: '',
223
+ confirmPassword: ''
224
+ });
225
+ </script>
226
+ <template>
227
+ <Form>
228
+ <FormItem label="密码" :value="model.password" :rules="{required: true}">
229
+ <Input type="password" v-model="model.password" />
230
+ </FormItem>
231
+ <FormItem label="确认密码" :value="model.confirmPassword"
232
+ :rules="{required: true, equal: model.password}">
233
+ <Input type="password" v-model="model.confirmPassword" />
234
+ </FormItem>
235
+ </Form>
236
+ </template>
237
+ ```
64
238
 
65
239
  ## 常见错误与正确用法 (Anti-Hallucination)
240
+ ### FormItem 配置了 rules 但未绑定 value
66
241
  > **错误用法**: `<FormItem label="用户名" :rules="{required: true}">
67
242
  <Input v-model="model.username" />
68
243
  </FormItem>`
@@ -71,14 +246,17 @@ const handleSubmit = (e: Event) => {
71
246
  </FormItem>`
72
247
  > **说明**: 使用验证规则时,必须通过 :value 属性绑定需要验证的数据,否则验证不会生效
73
248
 
249
+ ### 使用不存在的 layout 值
74
250
  > **错误用法**: `<Form layout="flex">`
75
251
  > **正确写法**: `<Form layout="horizontal">`
76
252
  > **说明**: Form 的 layout 只支持 horizontal, vertical, inline 三种值
77
253
 
254
+ ### rules 格式错误
78
255
  > **错误用法**: `<FormItem :rules="'required'">`
79
256
  > **正确写法**: `<FormItem :rules="{required: true}">`
80
257
  > **说明**: rules 必须是对象格式,key 为规则名,value 为规则参数(通常为 true 或具体值)
81
258
 
259
+ ### validate 方法未使用 await
82
260
  > **错误用法**: `const valid = form.value?.validate();
83
261
  if (valid) { /* ... */ }`
84
262
  > **正确写法**: `const valid = await form.value?.validate();
@@ -91,7 +269,7 @@ if (valid) { /* ... */ }`
91
269
 
92
270
  基本的表单验证用法
93
271
 
94
- **使用的 API**: 属性: label, value, rules | 事件: submit
272
+ **使用的 API**: 属性: label, value, rules | 事件: submit | 方法: validate
95
273
 
96
274
  ```vue
97
275
  <script setup lang="ts">
@@ -271,7 +449,7 @@ const model = reactive({
271
449
 
272
450
  重置表单验证状态
273
451
 
274
- **使用的 API**: 属性: label, value, rules
452
+ **使用的 API**: 属性: label, value, rules | 方法: reset
275
453
 
276
454
  ```vue
277
455
  <script setup lang="ts">