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
@@ -0,0 +1,154 @@
1
+ # 业务弹窗 (VDialog)
2
+
3
+ 在基础 Dialog 之上补充默认触发器、受控显隐和异步确认逻辑的业务弹窗组件,适合表单弹窗和危险操作确认。
4
+
5
+ **关键词**: vdialog, dialog, 业务弹窗, 确认弹窗, 表单弹窗, trigger dialog
6
+
7
+ **使用场景**: 表单弹窗、异步确认弹窗、通过按钮触发的操作弹窗
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { VDialog } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | title | `string` | `""` | 否 | 弹窗标题 | - | - |
18
+ | size | `string` | `undefined` | 否 | 弹窗尺寸 | - | - |
19
+ | width | `string | number` | `undefined` | 否 | 弹窗宽度 | - | - |
20
+ | loading | `boolean` | `false` | 否 | 确认按钮加载状态 | - | - |
21
+ | disabledOk | `boolean` | `false` | 否 | 是否禁用确认按钮 | - | - |
22
+ | okText | `string` | `"确定"` | 否 | 确认按钮文案 | - | - |
23
+ | cancelText | `string` | `"取消"` | 否 | 取消按钮文案 | - | - |
24
+ | ok | `() => Promise<boolean | void> | boolean | void` | `undefined` | 否 | 确认时的异步处理函数,可返回 false 阻止关闭 | - | - |
25
+ | cancel | `() => void` | `undefined` | 否 | 取消时的回调逻辑 | - | - |
26
+ | container | `string | Function` | `undefined` | 否 | 指定弹窗挂载容器 | - | - |
27
+ | overlay | `boolean` | `true` | 否 | 是否显示遮罩层 | - | - |
28
+ | closable | `boolean` | `true` | 否 | 点击遮罩层是否可关闭 | - | - |
29
+ | terminate | `() => void` | `undefined` | 否 | 关闭动作统一回调 | - | - |
30
+ | escClosable | `boolean` | `true` | 否 | 是否允许 ESC 关闭 | - | - |
31
+ | hideClose | `boolean` | `false` | 否 | 是否隐藏右上角关闭按钮 | - | - |
32
+ | draggable | `boolean` | `false` | 否 | 是否允许拖拽弹窗 | - | - |
33
+ | mode | `string` | `undefined` | 否 | 弹窗展示模式 | - | - |
34
+ | hideTrigger | `boolean` | `false` | 否 | 隐藏默认 trigger,作为受控弹窗使用 | - | - |
35
+ | modelValue | `boolean | undefined` | `undefined` | 否 | 弹窗显示状态 | - | - |
36
+ | btnProps | `ButtonProps` | `undefined` | 否 | 默认 trigger 按钮属性 | - | - |
37
+ | btnText | `string` | `"打开对话框"` | 否 | 默认 trigger 按钮文案 | - | - |
38
+
39
+ ## 事件 (Events)
40
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
41
+ | --- | --- | --- | --- | --- |
42
+ | open | `@open` | 弹窗打开后触发 | `-` | `<Dialog v-model="visible" @open="handleOpen">` |
43
+ | close | `@close` | 弹窗关闭后触发,不管是什么原因导致的关闭 | `-` | `<Dialog v-model="visible" @close="handleClose">` |
44
+ | ok | `@ok` | 点击确定按钮时触发 | `-` | `<Dialog v-model="visible" @ok="handleOk">` |
45
+ | cancel | `@cancel` | 点击取消按钮时触发 | `-` | `<Dialog v-model="visible" @cancel="handleCancel">` |
46
+ | terminate | `@terminate` | 用户强行关闭弹窗时触发:点击关闭按钮、点击遮罩层、按ESC键 | `-` | `<Dialog v-model="visible" @terminate="handleTerminate">` |
47
+ | afterClose | `@after-close` | 弹窗退出动画执行完成后触发 | `-` | `<Dialog v-model="visible" @after-close="handleAfterClose">` |
48
+
49
+ ## 插槽 (Slots)
50
+ | 插槽名 | 说明 | 模板写法 | 示例 |
51
+ | --- | --- | --- | --- |
52
+ | default | 弹窗主体内容(body区域) | `默认插槽` | `<Dialog v-model="visible">
53
+ <p>弹窗内容</p>
54
+ </Dialog>` |
55
+ | header | 扩展弹窗头部 | `#header` | `<Dialog v-model="visible">
56
+ <template #header>
57
+ <h2>自定义头部</h2>
58
+ </template>
59
+ </Dialog>` |
60
+ | footer | 扩展弹窗底部按钮区域 | `#footer` | `<Dialog v-model="visible">
61
+ <template #footer>
62
+ <Button @click="visible = false">关闭</Button>
63
+ <Button type="primary" @click="handleSubmit">提交</Button>
64
+ </template>
65
+ </Dialog>` |
66
+ | content | 定义整个弹窗体,包括header、body、footer | `#content` | `<Dialog v-model="visible">
67
+ <template #content>
68
+ <!-- 完全自定义弹窗结构 -->
69
+ </template>
70
+ </Dialog>` |
71
+ | trigger | 自定义触发按钮或触发区域 | `<template #trigger>...</template>` | `<VDialog>
72
+ <template <template #trigger>...</template>>
73
+ 自定义trigger内容
74
+ </template>
75
+ </VDialog>` |
76
+
77
+ ### 插槽参数说明
78
+ **default**
79
+
80
+ - 参数结构: 无参数
81
+
82
+ **header**
83
+
84
+ - 参数结构: 无参数
85
+
86
+ **footer**
87
+
88
+ - 参数结构: 无参数
89
+
90
+ **content**
91
+
92
+ - 参数结构: 无参数
93
+
94
+ **trigger**
95
+
96
+ - 参数结构: 无参数
97
+
98
+ ## 使用示例
99
+ ### 受控表单弹窗
100
+ **场景**: 在页面中以受控方式打开一个承载业务表单的弹窗。
101
+
102
+ 通过 v-model 控制弹窗显隐,并在确认时执行异步逻辑。
103
+
104
+ **使用的 API**: 属性: modelValue, title, ok, hideTrigger
105
+
106
+ ```vue
107
+ <script setup lang="ts">
108
+ import { ref } from 'vue';
109
+ import { VDialog, FormItemInput } from '@ksyun-internal/versatile';
110
+
111
+ const visible = ref(false);
112
+ const name = ref('');
113
+ const handleOk = async () => {
114
+ console.log('submit', name.value);
115
+ };
116
+ </script>
117
+
118
+ <template>
119
+ <button @click="visible = true">新建实例</button>
120
+ <VDialog v-model="visible" title="新建实例" :ok="handleOk" :hide-trigger="true">
121
+ <FormItemInput v-model="name" label="实例名称" placeholder="请输入实例名称" />
122
+ </VDialog>
123
+ </template>
124
+ ```
125
+
126
+ ### 使用 trigger 插槽触发确认弹窗
127
+ **场景**: 在操作列或详情页中用自定义按钮触发危险操作确认弹窗。
128
+
129
+ 通过 trigger 插槽自定义入口,用于危险操作前的二次确认。
130
+
131
+ **使用的 API**: 属性: title, okText, ok
132
+
133
+ ```vue
134
+ <script setup lang="ts">
135
+ import { VDialog } from '@ksyun-internal/versatile';
136
+
137
+ const handleOk = async () => {
138
+ console.log('release instance');
139
+ };
140
+ </script>
141
+
142
+ <template>
143
+ <VDialog title="释放实例" ok-text="确认释放" :ok="handleOk">
144
+ <template #trigger>
145
+ <button>释放实例</button>
146
+ </template>
147
+ <div>释放后实例数据将被删除,且不可恢复。</div>
148
+ </VDialog>
149
+ </template>
150
+ ```
151
+
152
+ ## 相关组件
153
+ Dialog, VDrawer, useDialog
154
+
@@ -0,0 +1,148 @@
1
+ # 业务抽屉 (VDrawer)
2
+
3
+ 在基础 Drawer 之上补充默认触发器、受控显隐和异步确认逻辑的业务抽屉组件,适合编辑长表单和查看侧边详情。
4
+
5
+ **关键词**: vdrawer, drawer, 业务抽屉, 侧边抽屉, 编辑抽屉, slot drawer
6
+
7
+ **使用场景**: 侧边表单编辑、详情信息展示、通过按钮触发的抽屉
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { VDrawer } from '@ksyun-internal/versatile';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | title | `string` | `""` | 否 | 抽屉标题 | - | - |
18
+ | placement | `"left" | "right" | "top" | "bottom"` | `"right"` | 否 | 抽屉弹出方向 | - | - |
19
+ | size | `string` | `undefined` | 否 | 抽屉尺寸 | - | - |
20
+ | width | `string | number` | `undefined` | 否 | 抽屉宽度 | - | - |
21
+ | loading | `boolean` | `false` | 否 | 确认按钮加载状态 | - | - |
22
+ | disabledOk | `boolean` | `false` | 否 | 是否禁用确认按钮 | - | - |
23
+ | okText | `string` | `"确定"` | 否 | 确认按钮文案 | - | - |
24
+ | cancelText | `string` | `"取消"` | 否 | 取消按钮文案 | - | - |
25
+ | ok | `() => Promise<boolean | void> | boolean | void` | `undefined` | 否 | 确认时的异步处理函数,可返回 false 阻止关闭 | - | - |
26
+ | cancel | `() => void` | `undefined` | 否 | 取消时的回调逻辑 | - | - |
27
+ | hideClose | `boolean` | `false` | 否 | 是否隐藏右上角关闭按钮 | - | - |
28
+ | overlay | `boolean` | `true` | 否 | 是否显示遮罩层 | - | - |
29
+ | closable | `boolean` | `true` | 否 | 点击遮罩层是否可关闭 | - | - |
30
+ | escClosable | `boolean` | `true` | 否 | 是否允许 ESC 关闭 | - | - |
31
+ | draggable | `boolean` | `false` | 否 | 是否允许拖拽抽屉 | - | - |
32
+ | terminate | `() => void` | `undefined` | 否 | 关闭动作统一回调 | - | - |
33
+ | container | `string | Function` | `undefined` | 否 | 指定抽屉挂载容器 | - | - |
34
+ | mode | `string` | `undefined` | 否 | 抽屉展示模式 | - | - |
35
+ | hideTrigger | `boolean` | `false` | 否 | 隐藏默认 trigger,作为受控抽屉使用 | - | - |
36
+ | modelValue | `boolean | undefined` | `undefined` | 否 | 抽屉显示状态 | - | - |
37
+ | btnProps | `ButtonProps` | `undefined` | 否 | 默认 trigger 按钮属性 | - | - |
38
+ | btnText | `string` | `"打开抽屉"` | 否 | 默认 trigger 按钮文案 | - | - |
39
+
40
+ ## 事件 (Events)
41
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
42
+ | --- | --- | --- | --- | --- |
43
+ | open | `@open` | 抽屉打开后触发 | `-` | `<Drawer @open="handleOpen">` |
44
+ | close | `@close` | 抽屉关闭后触发,不管是什么原因导致的关闭 | `-` | `<Drawer @close="handleClose">` |
45
+ | ok | `@ok` | 点击确定按钮时触发 | `-` | `<Drawer @ok="handleOk">` |
46
+ | cancel | `@cancel` | 点击取消按钮时触发 | `-` | `<Drawer @cancel="handleCancel">` |
47
+ | terminate | `@terminate` | 用户强行关闭抽屉时触发(点击关闭按钮、遮罩层或按 ESC) | `-` | `<Drawer @terminate="handleTerminate">` |
48
+ | afterClose | `@afterClose` | 抽屉退出动画执行完成后触发 | `-` | `<Drawer @afterClose="handleAfterClose">` |
49
+
50
+ ## 插槽 (Slots)
51
+ | 插槽名 | 说明 | 模板写法 | 示例 |
52
+ | --- | --- | --- | --- |
53
+ | default | 抽屉主体内容区域 | `<VDrawer>...</VDrawer>` | `<VDrawer>
54
+ <template <VDrawer>...</VDrawer>>
55
+ 自定义default内容
56
+ </template>
57
+ </VDrawer>` |
58
+ | header | 自定义抽屉头部 | `<template #header>...</template>` | `<VDrawer>
59
+ <template <template #header>...</template>>头部内容</template>
60
+ </VDrawer>` |
61
+ | footer | 自定义抽屉底部操作区 | `<template #footer>...</template>` | `<VDrawer>
62
+ <template <template #footer>...</template>>底部内容</template>
63
+ </VDrawer>` |
64
+ | trigger | 自定义触发按钮或触发区域 | `<template #trigger>...</template>` | `<VDrawer>
65
+ <template <template #trigger>...</template>>
66
+ 自定义trigger内容
67
+ </template>
68
+ </VDrawer>` |
69
+
70
+ ### 插槽参数说明
71
+ **default**
72
+
73
+ - 参数结构: 无参数
74
+
75
+ **header**
76
+
77
+ - 参数结构: 无参数
78
+
79
+ **footer**
80
+
81
+ - 参数结构: 无参数
82
+
83
+ **trigger**
84
+
85
+ - 参数结构: 无参数
86
+
87
+ ## 使用示例
88
+ ### 侧边编辑抽屉
89
+ **场景**: 在列表页右侧滑出编辑面板,保留用户当前上下文。
90
+
91
+ 用抽屉承载较长的编辑表单,避免打断列表上下文。
92
+
93
+ **使用的 API**: 属性: modelValue, title, ok, hideTrigger
94
+
95
+ ```vue
96
+ <script setup lang="ts">
97
+ import { ref } from 'vue';
98
+ import { VDrawer, FormItemInput, Description } from '@ksyun-internal/versatile';
99
+
100
+ const visible = ref(false);
101
+ const name = ref('web-prod-01');
102
+ const remark = ref('支付链路核心实例');
103
+ const handleOk = async () => {
104
+ console.log('save', name.value, remark.value);
105
+ };
106
+ </script>
107
+
108
+ <template>
109
+ <button @click="visible = true">编辑实例</button>
110
+ <VDrawer v-model="visible" title="编辑实例" :ok="handleOk" :hide-trigger="true">
111
+ <FormItemInput v-model="name" label="实例名称" />
112
+ <Description v-model="remark" />
113
+ </VDrawer>
114
+ </template>
115
+ ```
116
+
117
+ ### 使用 trigger 和 footer 插槽自定义抽屉
118
+ **场景**: 在详情预览场景下通过自定义触发器和底部按钮扩展抽屉交互。
119
+
120
+ 通过 trigger 和 footer 插槽自定义抽屉打开方式和底部操作区。
121
+
122
+ **使用的 API**: 属性: modelValue, title, hideTrigger
123
+
124
+ ```vue
125
+ <script setup lang="ts">
126
+ import { ref } from 'vue';
127
+ import { VDrawer } from '@ksyun-internal/versatile';
128
+
129
+ const visible = ref(false);
130
+ </script>
131
+
132
+ <template>
133
+ <VDrawer v-model="visible" title="实例详情" :hide-trigger="false">
134
+ <template #trigger>
135
+ <button>查看详情</button>
136
+ </template>
137
+ <div>这里可以放详情摘要、监控图表或操作记录。</div>
138
+ <template #footer>
139
+ <button @click="visible = false">关闭</button>
140
+ <button>导出详情</button>
141
+ </template>
142
+ </VDrawer>
143
+ </template>
144
+ ```
145
+
146
+ ## 相关组件
147
+ Drawer, VDialog
148
+
@@ -12,28 +12,180 @@ import { VirtualList } from '@king-design/vue';
12
12
  ```
13
13
 
14
14
  ## 属性 (Props)
15
- | 属性名 | 类型 | 默认值 | 必填 | 说明 | 示例 |
16
- | --- | --- | --- | --- | --- | --- |
17
- | disabled | `boolean` | `false` | 否 | 是否禁用虚拟化,禁用后会渲染所有元素 | `<VirtualList disabled></VirtualList>` |
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | disabled | `boolean` | `false` | 否 | 是否禁用虚拟化,禁用后会渲染所有元素 | - | `<VirtualList disabled></VirtualList>` |
18
18
 
19
19
  ## 子组件 (Sub-Components)
20
20
  ### VirtualListContainer
21
21
  虚拟列表容器组件,用于组合式使用
22
22
 
23
+ #### 组合示例
24
+ ##### 组合式使用
25
+ **场景**: 使用子组件进行复杂布局
26
+
27
+ 使用子组件进行组合
28
+
29
+ ```vue
30
+ <script setup lang="ts">
31
+ import { ref, onMounted } from 'vue';
32
+ import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
33
+
34
+ const data = ref<{value: number; label: string}[]>([]);
35
+
36
+ onMounted(() => {
37
+ const arr = [];
38
+ for (let i = 0; i < 10000; i++) {
39
+ arr.push({ value: i, label: `列表项 ${i}` });
40
+ }
41
+ data.value = arr;
42
+ });
43
+ </script>
44
+ <template>
45
+ <div style="height: 400px;">
46
+ <VirtualListContainer>
47
+ <VirtualListPhantom />
48
+ <VirtualListWrapper tagName="ul">
49
+ <VirtualListRows>
50
+ <li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
51
+ {{ item.label }}
52
+ </li>
53
+ </VirtualListRows>
54
+ </VirtualListWrapper>
55
+ </VirtualListContainer>
56
+ </div>
57
+ </template>
58
+ ```
59
+
23
60
  ### VirtualListWrapper
24
61
  虚拟列表包装器组件,可通过 tagName 属性指定标签类型
25
62
 
63
+ #### 属性 (Props)
26
64
  | 属性名 | 类型 | 说明 | 示例 |
27
65
  | --- | --- | --- | --- |
28
66
  | tagName | `string` | 指定渲染的标签名 | `<VirtualListWrapper tagName="ul"></VirtualListWrapper>` |
29
67
 
68
+ #### 组合示例
69
+ ##### 组合式使用
70
+ **场景**: 使用子组件进行复杂布局
71
+
72
+ 使用子组件进行组合
73
+
74
+ **命中的子组件 API**: 属性: tagName
75
+
76
+ ```vue
77
+ <script setup lang="ts">
78
+ import { ref, onMounted } from 'vue';
79
+ import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
80
+
81
+ const data = ref<{value: number; label: string}[]>([]);
82
+
83
+ onMounted(() => {
84
+ const arr = [];
85
+ for (let i = 0; i < 10000; i++) {
86
+ arr.push({ value: i, label: `列表项 ${i}` });
87
+ }
88
+ data.value = arr;
89
+ });
90
+ </script>
91
+ <template>
92
+ <div style="height: 400px;">
93
+ <VirtualListContainer>
94
+ <VirtualListPhantom />
95
+ <VirtualListWrapper tagName="ul">
96
+ <VirtualListRows>
97
+ <li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
98
+ {{ item.label }}
99
+ </li>
100
+ </VirtualListRows>
101
+ </VirtualListWrapper>
102
+ </VirtualListContainer>
103
+ </div>
104
+ </template>
105
+ ```
106
+
30
107
  ### VirtualListPhantom
31
108
  占位组件,用于撑开滚动高度
32
109
 
110
+ #### 组合示例
111
+ ##### 组合式使用
112
+ **场景**: 使用子组件进行复杂布局
113
+
114
+ 使用子组件进行组合
115
+
116
+ ```vue
117
+ <script setup lang="ts">
118
+ import { ref, onMounted } from 'vue';
119
+ import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
120
+
121
+ const data = ref<{value: number; label: string}[]>([]);
122
+
123
+ onMounted(() => {
124
+ const arr = [];
125
+ for (let i = 0; i < 10000; i++) {
126
+ arr.push({ value: i, label: `列表项 ${i}` });
127
+ }
128
+ data.value = arr;
129
+ });
130
+ </script>
131
+ <template>
132
+ <div style="height: 400px;">
133
+ <VirtualListContainer>
134
+ <VirtualListPhantom />
135
+ <VirtualListWrapper tagName="ul">
136
+ <VirtualListRows>
137
+ <li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
138
+ {{ item.label }}
139
+ </li>
140
+ </VirtualListRows>
141
+ </VirtualListWrapper>
142
+ </VirtualListContainer>
143
+ </div>
144
+ </template>
145
+ ```
146
+
33
147
  ### VirtualListRows
34
148
  行渲染组件,包裹实际渲染的列表项
35
149
 
150
+ #### 组合示例
151
+ ##### 组合式使用
152
+ **场景**: 使用子组件进行复杂布局
153
+
154
+ 使用子组件进行组合
155
+
156
+ ```vue
157
+ <script setup lang="ts">
158
+ import { ref, onMounted } from 'vue';
159
+ import { VirtualListContainer, VirtualListWrapper, VirtualListPhantom, VirtualListRows } from '@king-design/vue';
160
+
161
+ const data = ref<{value: number; label: string}[]>([]);
162
+
163
+ onMounted(() => {
164
+ const arr = [];
165
+ for (let i = 0; i < 10000; i++) {
166
+ arr.push({ value: i, label: `列表项 ${i}` });
167
+ }
168
+ data.value = arr;
169
+ });
170
+ </script>
171
+ <template>
172
+ <div style="height: 400px;">
173
+ <VirtualListContainer>
174
+ <VirtualListPhantom />
175
+ <VirtualListWrapper tagName="ul">
176
+ <VirtualListRows>
177
+ <li v-for="item in data" :key="item.value" style="height: 40px; line-height: 40px;">
178
+ {{ item.label }}
179
+ </li>
180
+ </VirtualListRows>
181
+ </VirtualListWrapper>
182
+ </VirtualListContainer>
183
+ </div>
184
+ </template>
185
+ ```
186
+
36
187
  ## 常见错误与正确用法 (Anti-Hallucination)
188
+ ### 容器未设置高度
37
189
  > **错误用法**: `<VirtualList> <!-- 没有高度,无法滚动 -->
38
190
  <div v-for="item in data" :key="item.value">...</div>
39
191
  </VirtualList>`
@@ -42,10 +194,12 @@ import { VirtualList } from '@king-design/vue';
42
194
  </VirtualList>`
43
195
  > **说明**: VirtualList 容器必须设置固定高度才能正常工作
44
196
 
197
+ ### 列表项缺少 key
45
198
  > **错误用法**: `<div v-for="item in data">{{ item.label }}</div>`
46
199
  > **正确写法**: `<div v-for="item in data" :key="item.value">{{ item.label }}</div>`
47
200
  > **说明**: 每个列表项必须设置唯一的 key 以确保正确渲染
48
201
 
202
+ ### 数据量较小时启用虚拟化
49
203
  > **错误用法**: `const data = [1, 2, 3]; // 只有 3 条数据
50
204
  <VirtualList>...</VirtualList>`
51
205
  > **正确写法**: `const data = [1, 2, 3];
@@ -0,0 +1,61 @@
1
+ {
2
+ "id": "useCRUD",
3
+ "name": "useCRUD",
4
+ "displayName": "增删行状态管理",
5
+ "category": "form",
6
+ "description": "管理数组型表单项的新增与删除能力,并根据最大最小数量约束生成可直接用于按钮禁用态的结果。",
7
+ "importStatement": "import { useCRUD } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "models",
12
+ "type": "Ref<T[]>",
13
+ "required": true,
14
+ "description": "当前表单项数组"
15
+ },
16
+ {
17
+ "name": "initItem",
18
+ "type": "() => T",
19
+ "required": true,
20
+ "description": "新增项的初始化工厂函数"
21
+ },
22
+ {
23
+ "name": "maxInstanceNum",
24
+ "type": "number",
25
+ "required": false,
26
+ "description": "最大可新增数量"
27
+ },
28
+ {
29
+ "name": "minInstanceNum",
30
+ "type": "number",
31
+ "required": false,
32
+ "description": "最小保留数量"
33
+ }
34
+ ],
35
+ "returnType": "{ canAdd: ComputedRef<{ disabled: boolean; msg: string }>; canDelete: ComputedRef<{ disabled: boolean; msg: string }>; addItem: () => void; deleteItem: (index: number) => void; }",
36
+ "examples": [
37
+ {
38
+ "id": "dynamic_form_rows",
39
+ "title": "动态表单行增删",
40
+ "description": "控制实例配置行的新增与删除",
41
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useCRUD } from '@ksyun-internal/versatile';\n\nconst models = ref([{ name: '', value: '' }]);\nconst { canAdd, canDelete, addItem, deleteItem } = useCRUD(\n models,\n () => ({ name: '', value: '' }),\n 5,\n 1\n);\n</script>"
42
+ }
43
+ ],
44
+ "commonMistakes": [
45
+ {
46
+ "id": "shared_default_object",
47
+ "description": "直接复用同一个默认对象,导致新增项互相串值",
48
+ "wrongCode": "const defaultItem = { name: '', value: '' }; useCRUD(models, () => defaultItem);",
49
+ "correctCode": "useCRUD(models, () => ({ name: '', value: '' }));",
50
+ "explanation": "initItem 应返回新的对象实例,避免多个表单项共享引用。"
51
+ }
52
+ ],
53
+ "searchKeywords": [
54
+ "useCRUD",
55
+ "动态表单",
56
+ "新增 删除",
57
+ "数组项",
58
+ "canAdd",
59
+ "canDelete"
60
+ ]
61
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "id": "useCountdown",
3
+ "name": "useCountdown",
4
+ "displayName": "倒计时",
5
+ "category": "timer",
6
+ "description": "管理秒级或自定义间隔的倒计时流程,提供 start、reset、stop 和 pause/resume 等控制能力。",
7
+ "importStatement": "import { useCountdown } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "initialCountdown",
12
+ "type": "MaybeRefOrGetter<number>",
13
+ "required": true,
14
+ "description": "初始倒计时值"
15
+ },
16
+ {
17
+ "name": "options",
18
+ "type": "UseCountdownOptions",
19
+ "required": false,
20
+ "description": "倒计时配置,可设置 interval、immediate、onTick 和 onComplete"
21
+ }
22
+ ],
23
+ "returnType": "{ remaining: ShallowRef<number>; isActive: Readonly<ShallowRef<boolean>>; pause: () => void; resume: () => void; reset: (countdown?: MaybeRefOrGetter<number>) => void; stop: () => void; start: (countdown?: MaybeRefOrGetter<number>) => void; }",
24
+ "examples": [
25
+ {
26
+ "id": "sms_countdown",
27
+ "title": "短信验证码倒计时",
28
+ "description": "点击发送验证码后开始倒计时",
29
+ "code": "<script setup lang=\"ts\">\nimport { useCountdown } from '@ksyun-internal/versatile';\n\nconst { remaining, start, stop } = useCountdown(60, {\n immediate: false,\n onComplete: () => console.log('倒计时结束'),\n});\n</script>"
30
+ }
31
+ ],
32
+ "commonMistakes": [
33
+ {
34
+ "id": "expect_resume_reset",
35
+ "description": "把 resume 当作重新开始倒计时使用",
36
+ "wrongCode": "resume();",
37
+ "correctCode": "start(); // 或 reset(60) 后再 start()",
38
+ "explanation": "resume 只用于恢复暂停中的倒计时,不会重置剩余时间。"
39
+ }
40
+ ],
41
+ "searchKeywords": [
42
+ "useCountdown",
43
+ "倒计时",
44
+ "remaining",
45
+ "短信验证码",
46
+ "start stop",
47
+ "pause resume"
48
+ ]
49
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "id": "useDetail",
3
+ "name": "useDetail",
4
+ "displayName": "详情页状态守卫",
5
+ "category": "page",
6
+ "description": "围绕详情页数据、网络状态和路由跳转封装守卫逻辑,适合详情页数据为空、请求异常或需要回退列表页的场景。",
7
+ "importStatement": "import { useDetail } from '@ksyun-internal/versatile';",
8
+ "source": "@ksyun-internal/versatile",
9
+ "params": [
10
+ {
11
+ "name": "detailData",
12
+ "type": "Ref<T | null | undefined>",
13
+ "required": true,
14
+ "description": "详情数据响应式对象"
15
+ },
16
+ {
17
+ "name": "networkStatus",
18
+ "type": "Ref<number | undefined>",
19
+ "required": true,
20
+ "description": "网络状态响应式值"
21
+ },
22
+ {
23
+ "name": "routerName",
24
+ "type": "string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric",
25
+ "required": false,
26
+ "description": "异常时回退的路由信息"
27
+ },
28
+ {
29
+ "name": "refetch",
30
+ "type": "() => void",
31
+ "required": false,
32
+ "description": "重新拉取详情数据的方法"
33
+ },
34
+ {
35
+ "name": "tip",
36
+ "type": "string",
37
+ "required": false,
38
+ "description": "详情不存在或异常时展示的提示文案"
39
+ }
40
+ ],
41
+ "returnType": "void",
42
+ "examples": [
43
+ {
44
+ "id": "detail_guard",
45
+ "title": "详情页请求守卫",
46
+ "description": "在详情页请求为空或异常时统一处理跳转和重试",
47
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { useDetail } from '@ksyun-internal/versatile';\n\nconst detailData = ref();\nconst networkStatus = ref(7);\nconst refetch = () => console.log('retry');\n\nuseDetail(detailData, networkStatus, { name: 'instance-list' }, refetch, '实例不存在');\n</script>"
48
+ }
49
+ ],
50
+ "commonMistakes": [
51
+ {
52
+ "id": "missing_network_status",
53
+ "description": "只传详情数据,没有把网络状态传给 hook,导致无法区分加载中和异常态",
54
+ "wrongCode": "useDetail(detailData);",
55
+ "correctCode": "useDetail(detailData, networkStatus, 'instance-list');",
56
+ "explanation": "networkStatus 是 hook 判断详情状态的重要输入。"
57
+ }
58
+ ],
59
+ "searchKeywords": [
60
+ "useDetail",
61
+ "详情页",
62
+ "networkStatus",
63
+ "详情守卫",
64
+ "异常跳转",
65
+ "refetch"
66
+ ]
67
+ }