king-design-analyzer 2.2.0 → 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 (149) hide show
  1. package/components/actions.json +8 -0
  2. package/components/advancedset.json +1 -0
  3. package/components/affix.json +1 -0
  4. package/components/anchor.json +220 -0
  5. package/components/anchorlink.json +111 -0
  6. package/components/badge.json +1 -0
  7. package/components/breadcrumb.json +2 -1
  8. package/components/button.json +1 -0
  9. package/components/buttonlink.json +1 -0
  10. package/components/card.json +6 -3
  11. package/components/cardcontent.json +5 -0
  12. package/components/cascader.json +56 -0
  13. package/components/collapse.json +335 -348
  14. package/components/configprovider.json +96 -0
  15. package/components/copyrow.json +1 -0
  16. package/components/descriptions.json +10 -3
  17. package/components/diagram.json +295 -0
  18. package/components/dialog.json +4 -0
  19. package/components/divider.json +1 -0
  20. package/components/drawer.json +32 -0
  21. package/components/dropdown.json +4 -4
  22. package/components/flex.json +1 -0
  23. package/components/form.json +12 -3
  24. package/components/header.json +4 -0
  25. package/components/input.json +8 -4
  26. package/components/layoutcontent.json +9 -0
  27. package/components/layoutlistcontent.json +9 -0
  28. package/components/layoutpermissioncontent.json +1 -0
  29. package/components/layoutstandardlist.json +1 -0
  30. package/components/lazymount.json +1 -0
  31. package/components/lazyteleport.json +1 -0
  32. package/components/menu.json +4 -3
  33. package/components/notification.json +351 -0
  34. package/components/protable.json +2 -0
  35. package/components/rate.json +1 -0
  36. package/components/scrollselect.json +140 -0
  37. package/components/select.json +63 -0
  38. package/components/skeleton.json +1 -0
  39. package/components/slider.json +12 -2
  40. package/components/spin.json +2 -1
  41. package/components/spinner.json +419 -429
  42. package/components/split.json +3 -0
  43. package/components/switch.json +4 -2
  44. package/components/table.json +6 -1
  45. package/components/tabs.json +2 -2
  46. package/components/tag.json +8 -5
  47. package/components/timeline.json +3 -1
  48. package/components/tip.json +20 -0
  49. package/components/tooltip.json +8 -0
  50. package/components/transfer.json +52 -5
  51. package/components/tree.json +22 -1
  52. package/components/treeselect.json +56 -0
  53. package/components/vdialog.json +1 -0
  54. package/components/vdrawer.json +4 -0
  55. package/dist/ast/index.d.mts +30 -1
  56. package/dist/ast/index.d.ts +30 -1
  57. package/dist/ast/index.js +3 -3
  58. package/dist/ast/index.mjs +1 -1
  59. package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
  60. package/dist/{chunk-CJGGFVQJ.js → chunk-4WXOYU2N.js} +31 -8
  61. package/dist/chunk-6HOIRUQB.mjs +409 -0
  62. package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
  63. package/dist/{chunk-KMIDURUR.mjs → chunk-IPJJMPOO.mjs} +113 -19
  64. package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
  65. package/dist/{chunk-SZYVGYKK.js → chunk-JNRGUR3O.js} +113 -19
  66. package/dist/{chunk-XGPHQHLR.mjs → chunk-LRTDTFFQ.mjs} +27 -4
  67. package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
  68. package/dist/chunk-V5N65MRP.js +411 -0
  69. package/dist/full/index.d.mts +2 -0
  70. package/dist/full/index.d.ts +2 -0
  71. package/dist/full/index.js +6 -6
  72. package/dist/full/index.mjs +4 -4
  73. package/dist/index.js +13 -13
  74. package/dist/index.mjs +5 -5
  75. package/dist/metadata/index.d.mts +17 -2
  76. package/dist/metadata/index.d.ts +17 -2
  77. package/dist/runtime/index.d.mts +2 -0
  78. package/dist/runtime/index.d.ts +2 -0
  79. package/dist/runtime/index.js +4 -4
  80. package/dist/runtime/index.mjs +2 -2
  81. package/dist/static/index.js +5 -5
  82. package/dist/static/index.mjs +2 -2
  83. package/docs_for_llm/actions.doc.md +11 -1
  84. package/docs_for_llm/advancedset.doc.md +10 -1
  85. package/docs_for_llm/affix.doc.md +5 -0
  86. package/docs_for_llm/anchor.doc.md +155 -0
  87. package/docs_for_llm/anchorlink.doc.md +75 -0
  88. package/docs_for_llm/badge.doc.md +5 -0
  89. package/docs_for_llm/breadcrumb.doc.md +74 -1
  90. package/docs_for_llm/button.doc.md +57 -0
  91. package/docs_for_llm/buttonlink.doc.md +10 -1
  92. package/docs_for_llm/card.doc.md +50 -3
  93. package/docs_for_llm/cardcontent.doc.md +21 -0
  94. package/docs_for_llm/carousel.doc.md +71 -0
  95. package/docs_for_llm/cascader.doc.md +62 -0
  96. package/docs_for_llm/collapse.doc.md +138 -8
  97. package/docs_for_llm/configprovider.doc.md +77 -0
  98. package/docs_for_llm/copyrow.doc.md +10 -1
  99. package/docs_for_llm/datepicker.doc.md +19 -0
  100. package/docs_for_llm/descriptions.doc.md +113 -4
  101. package/docs_for_llm/diagram.doc.md +343 -0
  102. package/docs_for_llm/dialog.doc.md +49 -0
  103. package/docs_for_llm/divider.doc.md +5 -0
  104. package/docs_for_llm/drawer.doc.md +86 -0
  105. package/docs_for_llm/dropdown.doc.md +240 -3
  106. package/docs_for_llm/flex.doc.md +10 -1
  107. package/docs_for_llm/form.doc.md +163 -4
  108. package/docs_for_llm/formitemspinner.doc.md +1 -1
  109. package/docs_for_llm/grid.doc.md +71 -0
  110. package/docs_for_llm/header.doc.md +33 -4
  111. package/docs_for_llm/input.doc.md +109 -2
  112. package/docs_for_llm/layoutcontent.doc.md +37 -0
  113. package/docs_for_llm/layoutlistcontent.doc.md +82 -9
  114. package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
  115. package/docs_for_llm/layoutstandardlist.doc.md +10 -1
  116. package/docs_for_llm/lazymount.doc.md +10 -1
  117. package/docs_for_llm/lazyteleport.doc.md +10 -1
  118. package/docs_for_llm/menu.doc.md +125 -3
  119. package/docs_for_llm/message.doc.md +45 -0
  120. package/docs_for_llm/notification.doc.md +214 -0
  121. package/docs_for_llm/protable.doc.md +9 -0
  122. package/docs_for_llm/rate.doc.md +5 -0
  123. package/docs_for_llm/scrollselect.doc.md +90 -0
  124. package/docs_for_llm/select.doc.md +174 -0
  125. package/docs_for_llm/skeleton.doc.md +35 -0
  126. package/docs_for_llm/slider.doc.md +11 -1
  127. package/docs_for_llm/spin.doc.md +10 -1
  128. package/docs_for_llm/spinner.doc.md +1 -1
  129. package/docs_for_llm/split.doc.md +13 -0
  130. package/docs_for_llm/steps.doc.md +71 -0
  131. package/docs_for_llm/switch.doc.md +15 -2
  132. package/docs_for_llm/table.doc.md +199 -4
  133. package/docs_for_llm/tabs.doc.md +98 -2
  134. package/docs_for_llm/tag.doc.md +148 -5
  135. package/docs_for_llm/timeline.doc.md +80 -2
  136. package/docs_for_llm/timepicker.doc.md +19 -0
  137. package/docs_for_llm/tip.doc.md +30 -0
  138. package/docs_for_llm/tooltip.doc.md +46 -0
  139. package/docs_for_llm/tour.doc.md +78 -0
  140. package/docs_for_llm/transfer.doc.md +59 -4
  141. package/docs_for_llm/tree.doc.md +64 -1
  142. package/docs_for_llm/treeselect.doc.md +68 -0
  143. package/docs_for_llm/upload.doc.md +7 -0
  144. package/docs_for_llm/vdialog.doc.md +26 -1
  145. package/docs_for_llm/vdrawer.doc.md +33 -4
  146. package/docs_for_llm/virtuallist.doc.md +151 -0
  147. package/package.json +3 -3
  148. package/dist/chunk-D2SXGGTX.mjs +0 -162
  149. package/dist/chunk-EYKZY2F3.js +0 -164
@@ -168,6 +168,23 @@ const handleMouseleave = (e: MouseEvent) => {
168
168
  <template #suffix><Icon class="k-icon-search" /></template>
169
169
  </Input>` |
170
170
 
171
+ ### 插槽参数说明
172
+ **prepend**
173
+
174
+ - 参数结构: 无参数
175
+
176
+ **append**
177
+
178
+ - 参数结构: 无参数
179
+
180
+ **prefix**
181
+
182
+ - 参数结构: 无参数
183
+
184
+ **suffix**
185
+
186
+ - 参数结构: 无参数
187
+
171
188
  ## 方法 (Methods)
172
189
  | 方法名 | 说明 | 参数 | 返回值 |
173
190
  | --- | --- | --- | --- |
@@ -175,10 +192,31 @@ const handleMouseleave = (e: MouseEvent) => {
175
192
  | blur | 使输入框失去焦点 | `-` | `void` |
176
193
  | select | 全选输入框中的内容 | `-` | `void` |
177
194
 
195
+ ### 方法调用示例
196
+ **focus**
197
+
198
+ ```typescript
199
+ const inputRef = ref<InstanceType<typeof Input>>();
200
+ inputRef.value?.focus();</InstanceType>
201
+ ```
202
+
203
+ **blur**
204
+
205
+ ```typescript
206
+ inputRef.value?.blur();
207
+ ```
208
+
209
+ **select**
210
+
211
+ ```typescript
212
+ inputRef.value?.select();
213
+ ```
214
+
178
215
  ## 子组件 (Sub-Components)
179
216
  ### Search
180
217
  搜索框组件,提供可展开收起的搜索输入框功能
181
218
 
219
+ #### 属性 (Props)
182
220
  | 属性名 | 类型 | 说明 | 示例 |
183
221
  | --- | --- | --- | --- |
184
222
  | value | `string` | 组件输入的值 | `<Search v-model="keywords" />` |
@@ -187,8 +225,77 @@ const handleMouseleave = (e: MouseEvent) => {
187
225
  | size | `"large" | "default" | "small" | "mini"` | 尺寸 | `<Search size="small" />` |
188
226
  | open | `boolean` | 是否展开状态 | `<Search :open="isExpanded" />` |
189
227
 
190
- **事件**:
191
- - `@submit`: 表单提交事件,按回车或点击搜索按钮时触发
228
+ #### 事件 (Events)
229
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
230
+ | --- | --- | --- | --- | --- |
231
+ | submit | `@submit` | 表单提交事件,按回车或点击搜索按钮时触发 | `keywords: string` | `<Search @submit="handleKeywordSearch" />` |
232
+
233
+ ##### Search 事件参数说明
234
+ **submit**
235
+
236
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
237
+ | --- | --- | --- | --- | --- |
238
+ | keywords | `string` | 是 | - | 当前搜索关键字 |
239
+
240
+ 事件处理示例:
241
+ ```typescript
242
+ const searchHistory = ref<string[]>([]);
243
+
244
+ const handleKeywordSearch = (keywords: string) => {
245
+ const normalized = keywords.trim();
246
+ if (!normalized) return;
247
+ searchHistory.value = [normalized, ...searchHistory.value.filter((item) => item !== normalized)].slice(0, 5);
248
+ };
249
+ ```
250
+
251
+ #### 方法 (Methods)
252
+ | 方法名 | 说明 | 参数 | 返回值 |
253
+ | --- | --- | --- | --- |
254
+ | focus | 使搜索框获得焦点 | `-` | `void` |
255
+ | blur | 使搜索框失去焦点 | `-` | `void` |
256
+
257
+ ##### Search 方法调用示例
258
+ **focus**
259
+
260
+ ```typescript
261
+ const searchRef = ref<InstanceType<typeof Search>>();
262
+
263
+ const openSearchBar = () => {
264
+ searchRef.value?.focus();
265
+ };
266
+ ```
267
+
268
+ **blur**
269
+
270
+ ```typescript
271
+ const closeSearchBar = () => {
272
+ searchRef.value?.blur();
273
+ };
274
+ ```
275
+
276
+ #### 组合示例
277
+ ##### 搜索框
278
+ **场景**: 创建搜索框,支持回车提交
279
+
280
+ 使用 Search 组件创建搜索输入框
281
+
282
+ **命中的子组件 API**: 事件: submit
283
+
284
+ ```vue
285
+ <script setup lang="ts">
286
+ import { ref } from 'vue';
287
+ import { Search, Message } from '@king-design/vue';
288
+
289
+ const keywords = ref('');
290
+
291
+ const handleSubmit = (value: string) => {
292
+ Message.info(`搜索: ${value}`);
293
+ };
294
+ </script>
295
+ <template>
296
+ <Search v-model="keywords" @submit="handleSubmit" />
297
+ </template>
298
+ ```
192
299
 
193
300
  ## 常见错误与正确用法 (Anti-Hallucination)
194
301
  ### 设置 rows 但未指定 type="textarea"
@@ -41,3 +41,40 @@ import { LayoutContent } from '@ksyun-internal/versatile';
41
41
  | footerRight | 扩展底部栏右侧处内容 | `<template #footerRight>...</template>` | `<LayoutContent><template #footerRight><Button>提交</Button></template></LayoutContent>` |
42
42
  | footer | 扩展底部栏处的整体内容,底部栏没有左右之分的时候可使用此扩展 | `<template #footer>...</template>` | `<LayoutContent><template #footer><Button>保存</Button><Button>取消</Button></template></LayoutContent>` |
43
43
 
44
+ ### 插槽参数说明
45
+ **default**
46
+
47
+ - 参数结构: 无参数
48
+
49
+ **headerTitle**
50
+
51
+ - 参数结构: 无参数
52
+
53
+ **headerTitleAppend**
54
+
55
+ - 参数结构: 无参数
56
+
57
+ **headerDocPrepend**
58
+
59
+ - 参数结构: 无参数
60
+
61
+ **headerDoc**
62
+
63
+ - 参数结构: 无参数
64
+
65
+ **tab**
66
+
67
+ - 参数结构: 无参数
68
+
69
+ **footerLeft**
70
+
71
+ - 参数结构: 无参数
72
+
73
+ **footerRight**
74
+
75
+ - 参数结构: 无参数
76
+
77
+ **footer**
78
+
79
+ - 参数结构: 无参数
80
+
@@ -21,15 +21,88 @@ import { LayoutListContent } from '@ksyun-internal/versatile';
21
21
  ## 插槽 (Slots)
22
22
  | 插槽名 | 说明 | 模板写法 | 示例 |
23
23
  | --- | --- | --- | --- |
24
- | default | 页面主体内容区域 | `<LayoutListContent>...</LayoutListContent>` | - |
25
- | headerTitle | 扩展顶部栏左侧标题处内容 | `<template #headerTitle>...</template>` | - |
26
- | headerTitleAppend | 扩展顶部栏左侧标题后的追加内容 | `<template #headerTitleAppend>...</template>` | - |
27
- | headerDocPrepend | 扩展顶部栏右侧文档前置内容 | `<template #headerDocPrepend>...</template>` | - |
28
- | headerDoc | 扩展顶部栏右侧文档内容 | `<template #headerDoc>...</template>` | - |
29
- | opLeft | 卡片操作栏左侧内容 | `<template #opLeft>...</template>` | - |
30
- | opRight | 卡片操作栏右侧内容 | `<template #opRight>...</template>` | - |
31
- | prepend | 卡片操作栏上方扩展内容 | `<template #prepend>...</template>` | - |
32
- | extra | 头部附加区域 | `<template #extra>...</template>` | - |
24
+ | default | 页面主体内容区域 | `<LayoutListContent>...</LayoutListContent>` | `<LayoutListContent>
25
+ <template <LayoutListContent>...</LayoutListContent>>
26
+ 自定义default内容
27
+ </template>
28
+ </LayoutListContent>` |
29
+ | headerTitle | 扩展顶部栏左侧标题处内容 | `<template #headerTitle>...</template>` | `<LayoutListContent>
30
+ <template <template #headerTitle>...</template>>
31
+ 自定义headerTitle内容
32
+ </template>
33
+ </LayoutListContent>` |
34
+ | headerTitleAppend | 扩展顶部栏左侧标题后的追加内容 | `<template #headerTitleAppend>...</template>` | `<LayoutListContent>
35
+ <template <template #headerTitleAppend>...</template>>
36
+ 自定义headerTitleAppend内容
37
+ </template>
38
+ </LayoutListContent>` |
39
+ | headerDocPrepend | 扩展顶部栏右侧文档前置内容 | `<template #headerDocPrepend>...</template>` | `<LayoutListContent>
40
+ <template <template #headerDocPrepend>...</template>>
41
+ 自定义headerDocPrepend内容
42
+ </template>
43
+ </LayoutListContent>` |
44
+ | headerDoc | 扩展顶部栏右侧文档内容 | `<template #headerDoc>...</template>` | `<LayoutListContent>
45
+ <template <template #headerDoc>...</template>>
46
+ 自定义headerDoc内容
47
+ </template>
48
+ </LayoutListContent>` |
49
+ | opLeft | 卡片操作栏左侧内容 | `<template #opLeft>...</template>` | `<LayoutListContent>
50
+ <template <template #opLeft>...</template>>
51
+ 自定义opLeft内容
52
+ </template>
53
+ </LayoutListContent>` |
54
+ | opRight | 卡片操作栏右侧内容 | `<template #opRight>...</template>` | `<LayoutListContent>
55
+ <template <template #opRight>...</template>>
56
+ 自定义opRight内容
57
+ </template>
58
+ </LayoutListContent>` |
59
+ | prepend | 卡片操作栏上方扩展内容 | `<template #prepend>...</template>` | `<LayoutListContent>
60
+ <template <template #prepend>...</template>>
61
+ 自定义prepend内容
62
+ </template>
63
+ </LayoutListContent>` |
64
+ | extra | 头部附加区域 | `<template #extra>...</template>` | `<LayoutListContent>
65
+ <template <template #extra>...</template>>
66
+ 自定义extra内容
67
+ </template>
68
+ </LayoutListContent>` |
69
+
70
+ ### 插槽参数说明
71
+ **default**
72
+
73
+ - 参数结构: 无参数
74
+
75
+ **headerTitle**
76
+
77
+ - 参数结构: 无参数
78
+
79
+ **headerTitleAppend**
80
+
81
+ - 参数结构: 无参数
82
+
83
+ **headerDocPrepend**
84
+
85
+ - 参数结构: 无参数
86
+
87
+ **headerDoc**
88
+
89
+ - 参数结构: 无参数
90
+
91
+ **opLeft**
92
+
93
+ - 参数结构: 无参数
94
+
95
+ **opRight**
96
+
97
+ - 参数结构: 无参数
98
+
99
+ **prepend**
100
+
101
+ - 参数结构: 无参数
102
+
103
+ **extra**
104
+
105
+ - 参数结构: 无参数
33
106
 
34
107
  ## 使用示例
35
108
  ### 标准列表页布局
@@ -30,7 +30,16 @@ import { LayoutPermissionContent } from '@ksyun-internal/versatile';
30
30
  ## 插槽 (Slots)
31
31
  | 插槽名 | 说明 | 模板写法 | 示例 |
32
32
  | --- | --- | --- | --- |
33
- | default | 主内容区域 | `<LayoutPermissionContent>...</LayoutPermissionContent>` | - |
33
+ | default | 主内容区域 | `<LayoutPermissionContent>...</LayoutPermissionContent>` | `<LayoutPermissionContent>
34
+ <template <LayoutPermissionContent>...</LayoutPermissionContent>>
35
+ 自定义default内容
36
+ </template>
37
+ </LayoutPermissionContent>` |
38
+
39
+ ### 插槽参数说明
40
+ **default**
41
+
42
+ - 参数结构: 无参数
34
43
 
35
44
  ## 使用示例
36
45
  ### 无权限状态页
@@ -37,7 +37,16 @@ import { LayoutStandardList } from '@ksyun-internal/versatile';
37
37
  ## 插槽 (Slots)
38
38
  | 插槽名 | 说明 | 模板写法 | 示例 |
39
39
  | --- | --- | --- | --- |
40
- | default | 自定义列表主体内容 | `<LayoutStandardList>...</LayoutStandardList>` | - |
40
+ | default | 自定义列表主体内容 | `<LayoutStandardList>...</LayoutStandardList>` | `<LayoutStandardList>
41
+ <template <LayoutStandardList>...</LayoutStandardList>>
42
+ 自定义default内容
43
+ </template>
44
+ </LayoutStandardList>` |
45
+
46
+ ### 插槽参数说明
47
+ **default**
48
+
49
+ - 参数结构: 无参数
41
50
 
42
51
  ## 使用示例
43
52
  ### 资源管理列表页
@@ -19,7 +19,16 @@ import { LazyMount } from '@ksyun-internal/versatile';
19
19
  ## 插槽 (Slots)
20
20
  | 插槽名 | 说明 | 模板写法 | 示例 |
21
21
  | --- | --- | --- | --- |
22
- | default | 延迟挂载的内容 | `<LazyMount>...</LazyMount>` | - |
22
+ | default | 延迟挂载的内容 | `<LazyMount>...</LazyMount>` | `<LazyMount>
23
+ <template <LazyMount>...</LazyMount>>
24
+ 自定义default内容
25
+ </template>
26
+ </LazyMount>` |
27
+
28
+ ### 插槽参数说明
29
+ **default**
30
+
31
+ - 参数结构: 无参数
23
32
 
24
33
  ## 使用示例
25
34
  ### 延迟挂载重量级图表
@@ -22,7 +22,16 @@ import { LazyTeleport } from '@ksyun-internal/versatile';
22
22
  ## 插槽 (Slots)
23
23
  | 插槽名 | 说明 | 模板写法 | 示例 |
24
24
  | --- | --- | --- | --- |
25
- | default | 待传送内容 | `<LazyTeleport>...</LazyTeleport>` | - |
25
+ | default | 待传送内容 | `<LazyTeleport>...</LazyTeleport>` | `<LazyTeleport>
26
+ <template <LazyTeleport>...</LazyTeleport>>
27
+ 自定义default内容
28
+ </template>
29
+ </LazyTeleport>` |
30
+
31
+ ### 插槽参数说明
32
+ **default**
33
+
34
+ - 参数结构: 无参数
26
35
 
27
36
  ## 使用示例
28
37
  ### 延迟传送页面操作区
@@ -27,12 +27,20 @@ import { Menu, MenuItem } from '@king-design/vue';
27
27
  ## 插槽 (Slots)
28
28
  | 插槽名 | 说明 | 模板写法 | 示例 |
29
29
  | --- | --- | --- | --- |
30
- | header | 扩展菜单头部 | `undefined` | - |
30
+ | header | 扩展菜单头部 | `#header` | `<Menu>
31
+ <template #header>头部内容</template>
32
+ </Menu>` |
33
+
34
+ ### 插槽参数说明
35
+ **header**
36
+
37
+ - 参数结构: 无参数
31
38
 
32
39
  ## 子组件 (Sub-Components)
33
40
  ### MenuItem
34
41
  菜单项组件,可嵌套使用形成子菜单
35
42
 
43
+ #### 属性 (Props)
36
44
  | 属性名 | 类型 | 说明 | 示例 |
37
45
  | --- | --- | --- | --- |
38
46
  | key | `string | number` | 全局唯一的标识,用于标识和控制选中状态 | `<MenuItem key="home">首页</MenuItem>` |
@@ -40,8 +48,122 @@ import { Menu, MenuItem } from '@king-design/vue';
40
48
  | disabled | `boolean` | 是否禁用当前项 | `<MenuItem key="disabled" disabled>禁用项</MenuItem>` |
41
49
  | dot | `boolean` | 是否给当前菜单项前面添加圆点 | `<MenuItem key="item" dot>带圆点</MenuItem>` |
42
50
 
43
- **事件**:
44
- - `@select`: 选中没有子菜单的菜单项时触发
51
+ #### 事件 (Events)
52
+ | 事件名 | Vue事件名 | 说明 | 回调参数 | 示例 |
53
+ | --- | --- | --- | --- | --- |
54
+ | select | `@select` | 选中没有子菜单的菜单项时触发 | `menuItem: MenuItem, e: MouseEvent` | `<MenuItem @select="handleMenuSelect"></MenuItem>` |
55
+
56
+ ##### MenuItem 事件参数说明
57
+ **select**
58
+
59
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
60
+ | --- | --- | --- | --- | --- |
61
+ | menuItem | `MenuItem` | 是 | - | 被选中的菜单项实例 |
62
+ | e | `MouseEvent` | 是 | - | 原生鼠标事件 |
63
+
64
+ 事件处理示例:
65
+ ```typescript
66
+ const activeSection = ref('');
67
+
68
+ const handleMenuSelect = (menuItem, e: MouseEvent) => {
69
+ activeSection.value = String(menuItem.key);
70
+ };
71
+ ```
72
+
73
+ #### 组合示例
74
+ ##### 带图标的嵌套菜单
75
+ **场景**: 创建带图标的多级嵌套菜单,包含禁用项和路由跳转
76
+
77
+ 图标和多级嵌套子菜单
78
+
79
+ **命中的子组件 API**: 属性: key, to, disabled | 事件: select
80
+
81
+ ```vue
82
+ <script setup lang="ts">
83
+ import { ref } from 'vue';
84
+ import { Menu, MenuItem, Icon } from '@king-design/vue';
85
+
86
+ const selectedKey = ref('');
87
+ const expandedKeys = ref<string[]>(['3']);
88
+
89
+ const onSelect = (menuItem: any) => {
90
+ console.log('选中:', menuItem.key);
91
+ };
92
+ </script>
93
+ <template>
94
+ <Menu
95
+ v-model:selectedKey="selectedKey"
96
+ v-model:expandedKeys="expandedKeys"
97
+ theme="light"
98
+ >
99
+ <MenuItem key="1" @select="onSelect">菜单 1</MenuItem>
100
+ <MenuItem key="2" disabled>菜单 2(禁用)</MenuItem>
101
+ <MenuItem key="3">
102
+ <Icon class="k-icon-heart" /> 菜单 3
103
+ <Menu>
104
+ <MenuItem key="3-1" @select="onSelect">子菜单 1</MenuItem>
105
+ <MenuItem key="3-2" @select="onSelect">子菜单 2</MenuItem>
106
+ <MenuItem key="3-3" disabled>子菜单 3(禁用)</MenuItem>
107
+ <MenuItem key="3-4">子菜单 4</MenuItem>
108
+ </Menu>
109
+ </MenuItem>
110
+ <MenuItem key="4" to="/">菜单 4(路由)</MenuItem>
111
+ </Menu>
112
+ </template>
113
+ ```
114
+
115
+ ##### 路由集成
116
+ **场景**: 配合 Vue Router 进行页面导航
117
+
118
+ 配合 Vue Router 使用
119
+
120
+ **命中的子组件 API**: 属性: key, to
121
+
122
+ ```vue
123
+ <script setup lang="ts">
124
+ import { ref } from 'vue';
125
+ import { Menu, MenuItem } from '@king-design/vue';
126
+
127
+ const selectedKey = ref('home');
128
+ </script>
129
+ <template>
130
+ <Menu v-model:selectedKey="selectedKey">
131
+ <MenuItem key="home" to="/">首页</MenuItem>
132
+ <MenuItem key="products" to="/products">产品</MenuItem>
133
+ <MenuItem key="docs" :to="{name: 'docs'}">文档</MenuItem>
134
+ </Menu>
135
+ </template>
136
+ ```
137
+
138
+ ##### 带圆点和头部
139
+ **场景**: 使用 dot 属性给菜单项添加圆点,使用 header 插槽自定义头部
140
+
141
+ 使用 dot 属性和 header 插槽
142
+
143
+ **命中的子组件 API**: 属性: key, dot
144
+
145
+ ```vue
146
+ <script setup lang="ts">
147
+ import { ref } from 'vue';
148
+ import { Menu, MenuItem } from '@king-design/vue';
149
+
150
+ const selectedKey = ref('1');
151
+ const expandedKeys = ref<string[]>([]);
152
+ </script>
153
+ <template>
154
+ <Menu
155
+ v-model:selectedKey="selectedKey"
156
+ v-model:expandedKeys="expandedKeys"
157
+ :dot="true"
158
+ theme="light"
159
+ >
160
+ <template #header>管理面板</template>
161
+ <MenuItem key="1">菜单项 1</MenuItem>
162
+ <MenuItem key="2">菜单项 2</MenuItem>
163
+ <MenuItem key="3" :dot="false">无圆点菜单项</MenuItem>
164
+ </Menu>
165
+ </template>
166
+ ```
45
167
 
46
168
  ## 常见错误与正确用法 (Anti-Hallucination)
47
169
  ### MenuItem 未设置 key
@@ -36,6 +36,11 @@ import { Message } from '@king-design/vue';
36
36
  | content | `string | VNode | Partial<MessageProps>` | 是 | - | 提示内容或配置对象 |
37
37
  | duration | `number` | 是 | - | 可选,显示时长(ms) |
38
38
 
39
+ 调用示例:
40
+ ```typescript
41
+ Message.info('这是一条普通消息');
42
+ ```
43
+
39
44
  **success**
40
45
 
41
46
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
@@ -43,6 +48,11 @@ import { Message } from '@king-design/vue';
43
48
  | content | `string | VNode | Partial<MessageProps>` | 是 | - | 提示内容或配置对象 |
44
49
  | duration | `number` | 是 | - | 可选,显示时长(ms) |
45
50
 
51
+ 调用示例:
52
+ ```typescript
53
+ Message.success('操作成功');
54
+ ```
55
+
46
56
  **warning**
47
57
 
48
58
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
@@ -50,6 +60,11 @@ import { Message } from '@king-design/vue';
50
60
  | content | `string | VNode | Partial<MessageProps>` | 是 | - | 提示内容或配置对象 |
51
61
  | duration | `number` | 是 | - | 可选,显示时长(ms) |
52
62
 
63
+ 调用示例:
64
+ ```typescript
65
+ Message.warning('请注意');
66
+ ```
67
+
53
68
  **error**
54
69
 
55
70
  | 参数 | 类型 | 必填 | 默认值 | 说明 |
@@ -57,6 +72,36 @@ import { Message } from '@king-design/vue';
57
72
  | content | `string | VNode | Partial<MessageProps>` | 是 | - | 提示内容或配置对象 |
58
73
  | duration | `number` | 是 | - | 可选,显示时长(ms) |
59
74
 
75
+ 调用示例:
76
+ ```typescript
77
+ Message.error('操作失败');
78
+ ```
79
+
80
+ ### 方法调用示例
81
+ **info**
82
+
83
+ ```typescript
84
+ Message.info('这是一条普通消息');
85
+ ```
86
+
87
+ **success**
88
+
89
+ ```typescript
90
+ Message.success('操作成功');
91
+ ```
92
+
93
+ **warning**
94
+
95
+ ```typescript
96
+ Message.warning('请注意');
97
+ ```
98
+
99
+ **error**
100
+
101
+ ```typescript
102
+ Message.error('操作失败');
103
+ ```
104
+
60
105
  ## 常见错误与正确用法 (Anti-Hallucination)
61
106
  ### 未导入 Message 组件
62
107
  > **错误用法**: `Message.success('成功'); // ReferenceError: Message is not defined`