king-design-analyzer 2.2.0 → 2.2.2

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 (154) 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 +13 -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/popover.json +23 -0
  35. package/components/protable.json +2 -0
  36. package/components/rate.json +1 -0
  37. package/components/scrollselect.json +140 -0
  38. package/components/select.json +72 -0
  39. package/components/skeleton.json +1 -0
  40. package/components/slider.json +12 -2
  41. package/components/spin.json +2 -1
  42. package/components/spinner.json +422 -428
  43. package/components/split.json +3 -0
  44. package/components/switch.json +4 -2
  45. package/components/table.json +6 -1
  46. package/components/tabs.json +2 -2
  47. package/components/tag.json +8 -5
  48. package/components/timeline.json +3 -1
  49. package/components/tip.json +20 -0
  50. package/components/tooltip.json +8 -0
  51. package/components/tour.json +16 -0
  52. package/components/transfer.json +52 -5
  53. package/components/tree.json +22 -1
  54. package/components/treeselect.json +56 -0
  55. package/components/upload.json +16 -0
  56. package/components/vdialog.json +1 -0
  57. package/components/vdrawer.json +4 -0
  58. package/components/virtuallist.json +9 -0
  59. package/dist/ast/index.d.mts +30 -1
  60. package/dist/ast/index.d.ts +30 -1
  61. package/dist/ast/index.js +3 -3
  62. package/dist/ast/index.mjs +1 -1
  63. package/dist/{chunk-BI5TIQID.mjs → chunk-4OTQAQ6J.mjs} +13 -2
  64. package/dist/chunk-6HOIRUQB.mjs +409 -0
  65. package/dist/{chunk-XGPHQHLR.mjs → chunk-BSCASJTV.mjs} +27 -4
  66. package/dist/{chunk-CR3GC4H3.js → chunk-DHLWNT53.js} +13 -2
  67. package/dist/{chunk-CJGGFVQJ.js → chunk-HARQRI4F.js} +31 -8
  68. package/dist/{chunk-TA3SV4SP.js → chunk-JJ6AB4ZH.js} +2 -2
  69. package/dist/{chunk-3LYQ5XFM.mjs → chunk-NZL6T22V.mjs} +1 -1
  70. package/dist/chunk-V5N65MRP.js +411 -0
  71. package/dist/{chunk-SZYVGYKK.js → chunk-XPHDD6XR.js} +113 -35
  72. package/dist/{chunk-KMIDURUR.mjs → chunk-YRGYDK2I.mjs} +113 -35
  73. package/dist/full/index.d.mts +2 -0
  74. package/dist/full/index.d.ts +2 -0
  75. package/dist/full/index.js +6 -6
  76. package/dist/full/index.mjs +4 -4
  77. package/dist/index.js +13 -13
  78. package/dist/index.mjs +5 -5
  79. package/dist/metadata/index.d.mts +17 -2
  80. package/dist/metadata/index.d.ts +17 -2
  81. package/dist/runtime/index.d.mts +2 -0
  82. package/dist/runtime/index.d.ts +2 -0
  83. package/dist/runtime/index.js +4 -4
  84. package/dist/runtime/index.mjs +2 -2
  85. package/dist/static/index.js +5 -5
  86. package/dist/static/index.mjs +2 -2
  87. package/docs_for_llm/actions.doc.md +11 -1
  88. package/docs_for_llm/advancedset.doc.md +10 -1
  89. package/docs_for_llm/affix.doc.md +5 -0
  90. package/docs_for_llm/anchor.doc.md +155 -0
  91. package/docs_for_llm/anchorlink.doc.md +75 -0
  92. package/docs_for_llm/badge.doc.md +5 -0
  93. package/docs_for_llm/breadcrumb.doc.md +74 -1
  94. package/docs_for_llm/button.doc.md +57 -0
  95. package/docs_for_llm/buttonlink.doc.md +10 -1
  96. package/docs_for_llm/card.doc.md +50 -3
  97. package/docs_for_llm/cardcontent.doc.md +21 -0
  98. package/docs_for_llm/carousel.doc.md +71 -0
  99. package/docs_for_llm/cascader.doc.md +62 -0
  100. package/docs_for_llm/collapse.doc.md +138 -8
  101. package/docs_for_llm/configprovider.doc.md +77 -0
  102. package/docs_for_llm/copyrow.doc.md +10 -1
  103. package/docs_for_llm/datepicker.doc.md +19 -0
  104. package/docs_for_llm/descriptions.doc.md +113 -4
  105. package/docs_for_llm/diagram.doc.md +343 -0
  106. package/docs_for_llm/dialog.doc.md +49 -0
  107. package/docs_for_llm/divider.doc.md +5 -0
  108. package/docs_for_llm/drawer.doc.md +86 -0
  109. package/docs_for_llm/dropdown.doc.md +257 -3
  110. package/docs_for_llm/flex.doc.md +10 -1
  111. package/docs_for_llm/form.doc.md +163 -4
  112. package/docs_for_llm/formitemspinner.doc.md +1 -1
  113. package/docs_for_llm/grid.doc.md +71 -0
  114. package/docs_for_llm/header.doc.md +33 -4
  115. package/docs_for_llm/input.doc.md +109 -2
  116. package/docs_for_llm/layoutcontent.doc.md +37 -0
  117. package/docs_for_llm/layoutlistcontent.doc.md +82 -9
  118. package/docs_for_llm/layoutpermissioncontent.doc.md +10 -1
  119. package/docs_for_llm/layoutstandardlist.doc.md +10 -1
  120. package/docs_for_llm/lazymount.doc.md +10 -1
  121. package/docs_for_llm/lazyteleport.doc.md +10 -1
  122. package/docs_for_llm/menu.doc.md +125 -3
  123. package/docs_for_llm/message.doc.md +45 -0
  124. package/docs_for_llm/notification.doc.md +214 -0
  125. package/docs_for_llm/popover.doc.md +34 -0
  126. package/docs_for_llm/protable.doc.md +9 -0
  127. package/docs_for_llm/rate.doc.md +5 -0
  128. package/docs_for_llm/scrollselect.doc.md +90 -0
  129. package/docs_for_llm/select.doc.md +189 -0
  130. package/docs_for_llm/skeleton.doc.md +35 -0
  131. package/docs_for_llm/slider.doc.md +11 -1
  132. package/docs_for_llm/spin.doc.md +10 -1
  133. package/docs_for_llm/spinner.doc.md +1 -1
  134. package/docs_for_llm/split.doc.md +13 -0
  135. package/docs_for_llm/steps.doc.md +71 -0
  136. package/docs_for_llm/switch.doc.md +15 -2
  137. package/docs_for_llm/table.doc.md +199 -4
  138. package/docs_for_llm/tabs.doc.md +98 -2
  139. package/docs_for_llm/tag.doc.md +148 -5
  140. package/docs_for_llm/timeline.doc.md +80 -2
  141. package/docs_for_llm/timepicker.doc.md +19 -0
  142. package/docs_for_llm/tip.doc.md +30 -0
  143. package/docs_for_llm/tooltip.doc.md +46 -0
  144. package/docs_for_llm/tour.doc.md +102 -0
  145. package/docs_for_llm/transfer.doc.md +59 -4
  146. package/docs_for_llm/tree.doc.md +64 -1
  147. package/docs_for_llm/treeselect.doc.md +68 -0
  148. package/docs_for_llm/upload.doc.md +28 -0
  149. package/docs_for_llm/vdialog.doc.md +26 -1
  150. package/docs_for_llm/vdrawer.doc.md +33 -4
  151. package/docs_for_llm/virtuallist.doc.md +165 -0
  152. package/package.json +3 -3
  153. package/dist/chunk-D2SXGGTX.mjs +0 -162
  154. package/dist/chunk-EYKZY2F3.js +0 -164
@@ -0,0 +1,214 @@
1
+ # 通知提醒 (Notification)
2
+
3
+ 全局通知组件,用于展示可停留、可关闭的系统级通知信息。支持不同语义类型、展示位置、自定义图标和点击回调,适合成功反馈、系统公告和后台异步任务提醒。
4
+
5
+ **关键词**: notification, 通知, 提醒, 全局通知, notice
6
+
7
+ **使用场景**: 系统公告提醒、异步任务完成通知、操作成功或失败反馈
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { Notification } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | title | `Children` | `undefined` | 否 | 通知标题内容 | - | `Notification.notice({ title: '部署完成' })` |
18
+ | content | `Children` | `undefined` | 否 | 通知正文内容 | - | `Notification.notice({ content: '实例已经创建成功' })` |
19
+ | duration | `number` | `5000` | 否 | 通知自动关闭时间,单位 ms;传入 0 表示不自动关闭 | - | `Notification.info({ title: '处理中', duration: 0 })` |
20
+ | type | `"info" | "error" | "success" | "warning" | ""` | `"info"` | 否 | 通知类型 | - | `Notification.success({ title: '发布成功' })` |
21
+ | closable | `boolean` | `true` | 否 | 是否显示关闭按钮 | - | `Notification.notice({ title: '系统公告', closable: false })` |
22
+ | icon | `string | VNode` | `undefined` | 否 | 自定义通知图标 | - | `Notification.notice({ title: '自定义图标', icon: 'k-icon-info' })` |
23
+ | position | `"topRight" | "topLeft" | "bottomRight" | "bottomLeft" | "top" | "bottom"` | `"topRight"` | 否 | 通知展示位置 | - | `Notification.info({ title: '左下角通知', position: 'bottomLeft' })` |
24
+ | className | `string` | `undefined` | 否 | 自定义通知根节点类名 | - | `Notification.notice({ title: '自定义样式', className: 'my-notification' })` |
25
+ | onClick | `(e: MouseEvent) => void` | `undefined` | 否 | 点击通知主体时触发的回调 | - | `Notification.notice({ title: '查看详情', onClick: () => console.log('clicked') })` |
26
+ | onClose | `() => void` | `undefined` | 否 | 通知关闭后触发的回调 | - | `Notification.notice({ title: '关闭回调', onClose: () => console.log('closed') })` |
27
+
28
+ ## 方法 (Methods)
29
+ | 方法名 | 说明 | 参数 | 返回值 |
30
+ | --- | --- | --- | --- |
31
+ | notice | 展示一条通知并返回唯一 ID | `props: Partial<NotificationProps>` | `number` |
32
+ | close | 关闭指定 ID 的通知 | `id: number` | `void` |
33
+ | info | 展示普通类型通知 | `props: Partial<NotificationProps>` | `number` |
34
+ | success | 展示成功类型通知 | `props: Partial<NotificationProps>` | `number` |
35
+ | warning | 展示警告类型通知 | `props: Partial<NotificationProps>` | `number` |
36
+ | error | 展示错误类型通知 | `props: Partial<NotificationProps>` | `number` |
37
+
38
+ ### 方法参数说明
39
+ **notice**
40
+
41
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
42
+ | --- | --- | --- | --- | --- |
43
+ | props | `Partial<NotificationProps>` | 是 | - | 通知配置对象 |
44
+
45
+ 调用示例:
46
+ ```typescript
47
+ const id = Notification.notice({ title: '部署完成', content: '实例已创建完成' });
48
+ ```
49
+
50
+ **close**
51
+
52
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
53
+ | --- | --- | --- | --- | --- |
54
+ | id | `number` | 是 | - | 由 notice 返回的通知 ID |
55
+
56
+ 调用示例:
57
+ ```typescript
58
+ Notification.close(id);
59
+ ```
60
+
61
+ **info**
62
+
63
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
64
+ | --- | --- | --- | --- | --- |
65
+ | props | `Partial<NotificationProps>` | 是 | - | 通知配置对象 |
66
+
67
+ 调用示例:
68
+ ```typescript
69
+ Notification.info({ title: '普通提醒', content: '这是一条信息通知' });
70
+ ```
71
+
72
+ **success**
73
+
74
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
75
+ | --- | --- | --- | --- | --- |
76
+ | props | `Partial<NotificationProps>` | 是 | - | 通知配置对象 |
77
+
78
+ 调用示例:
79
+ ```typescript
80
+ Notification.success({ title: '保存成功', content: '配置已更新' });
81
+ ```
82
+
83
+ **warning**
84
+
85
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
86
+ | --- | --- | --- | --- | --- |
87
+ | props | `Partial<NotificationProps>` | 是 | - | 通知配置对象 |
88
+
89
+ 调用示例:
90
+ ```typescript
91
+ Notification.warning({ title: '余额不足', content: '请尽快续费' });
92
+ ```
93
+
94
+ **error**
95
+
96
+ | 参数 | 类型 | 必填 | 默认值 | 说明 |
97
+ | --- | --- | --- | --- | --- |
98
+ | props | `Partial<NotificationProps>` | 是 | - | 通知配置对象 |
99
+
100
+ 调用示例:
101
+ ```typescript
102
+ Notification.error({ title: '提交失败', content: '请稍后重试' });
103
+ ```
104
+
105
+ ### 方法调用示例
106
+ **notice**
107
+
108
+ ```typescript
109
+ const id = Notification.notice({ title: '部署完成', content: '实例已创建完成' });
110
+ ```
111
+
112
+ **close**
113
+
114
+ ```typescript
115
+ Notification.close(id);
116
+ ```
117
+
118
+ **info**
119
+
120
+ ```typescript
121
+ Notification.info({ title: '普通提醒', content: '这是一条信息通知' });
122
+ ```
123
+
124
+ **success**
125
+
126
+ ```typescript
127
+ Notification.success({ title: '保存成功', content: '配置已更新' });
128
+ ```
129
+
130
+ **warning**
131
+
132
+ ```typescript
133
+ Notification.warning({ title: '余额不足', content: '请尽快续费' });
134
+ ```
135
+
136
+ **error**
137
+
138
+ ```typescript
139
+ Notification.error({ title: '提交失败', content: '请稍后重试' });
140
+ ```
141
+
142
+ ## 使用示例
143
+ ### 基础通知
144
+ **场景**: 在页面操作完成后展示全局反馈。
145
+
146
+ 点击按钮展示基础通知。
147
+
148
+ **使用的 API**: 方法: notice
149
+
150
+ ```vue
151
+ <script setup lang="ts">
152
+ import { Button, Notification } from '@king-design/vue';
153
+
154
+ const openNotification = () => {
155
+ Notification.notice({
156
+ title: 'Hello, King Design',
157
+ content: '这是一条基础通知',
158
+ });
159
+ };
160
+ </script>
161
+ <template>
162
+ <Button @click="openNotification">打开通知</Button>
163
+ </template>
164
+ ```
165
+
166
+ ### 不同类型
167
+ **场景**: 根据业务结果展示不同语义反馈。
168
+
169
+ 按语义展示不同类型的通知。
170
+
171
+ **使用的 API**: 属性: type | 方法: info, success, warning, error
172
+
173
+ ```vue
174
+ <script setup lang="ts">
175
+ import { Button, Notification } from '@king-design/vue';
176
+ </script>
177
+ <template>
178
+ <div style="display: flex; gap: 8px; flex-wrap: wrap;">
179
+ <Button @click="Notification.info({ title: '普通提醒', content: '这是一条信息通知' })">Info</Button>
180
+ <Button @click="Notification.success({ title: '发布成功', content: '版本已上线' })">Success</Button>
181
+ <Button @click="Notification.warning({ title: '容量不足', content: '请及时清理磁盘' })">Warning</Button>
182
+ <Button @click="Notification.error({ title: '同步失败', content: '网络连接异常' })">Error</Button>
183
+ </div>
184
+ </template>
185
+ ```
186
+
187
+ ### 位置与常驻
188
+ **场景**: 展示需要用户明确感知和手动关闭的通知。
189
+
190
+ 控制通知位置并让通知常驻直到手动关闭。
191
+
192
+ **使用的 API**: 属性: position, duration | 方法: notice
193
+
194
+ ```vue
195
+ <script setup lang="ts">
196
+ import { Button, Notification } from '@king-design/vue';
197
+
198
+ const openPinned = () => {
199
+ Notification.notice({
200
+ title: '系统公告',
201
+ content: '该通知位于底部且不会自动关闭',
202
+ position: 'bottom',
203
+ duration: 0,
204
+ });
205
+ };
206
+ </script>
207
+ <template>
208
+ <Button @click="openPinned">打开常驻通知</Button>
209
+ </template>
210
+ ```
211
+
212
+ ## 相关组件
213
+ Message, Dialog
214
+
@@ -38,6 +38,40 @@ import { Popover } from '@king-design/vue';
38
38
  | ok | `@ok` | 点击确认按钮时触发 | `-` | `<Popover @ok="handleOk">` |
39
39
  | cancel | `@cancel` | 点击取消按钮时触发 | `-` | `<Popover @cancel="handleCancel">` |
40
40
 
41
+ ## 插槽 (Slots)
42
+ | 插槽名 | 说明 | 模板写法 | 示例 |
43
+ | --- | --- | --- | --- |
44
+ | title | 自定义确认提示标题区域内容。 | `<template #title>...</template>` | `<Popover>
45
+ <template #title>删除实例</template>
46
+ <Button>删除</Button>
47
+ </Popover>` |
48
+ | content | 自定义确认提示主体内容。 | `<template #content>...</template>` | `<Popover>
49
+ <template #content>
50
+ 删除后将无法恢复,请确认操作。
51
+ </template>
52
+ <Button>删除</Button>
53
+ </Popover>` |
54
+ | footer | 自定义底部操作区内容,可覆盖默认的确认/取消按钮。 | `<template #footer>...</template>` | `<Popover>
55
+ <template #footer>
56
+ <Button size="small">稍后处理</Button>
57
+ <Button type="danger" size="small">立即删除</Button>
58
+ </template>
59
+ <Button>删除</Button>
60
+ </Popover>` |
61
+
62
+ ### 插槽参数说明
63
+ **title**
64
+
65
+ - 参数结构: 无参数
66
+
67
+ **content**
68
+
69
+ - 参数结构: 无参数
70
+
71
+ **footer**
72
+
73
+ - 参数结构: 无参数
74
+
41
75
  ## 常见错误与正确用法 (Anti-Hallucination)
42
76
  ### 未提供触发元素
43
77
  > **错误用法**: `<Popover title="确认" content="内容" />`
@@ -135,6 +135,15 @@ import { ProTable } from '@ksyun-internal/versatile';
135
135
  | actions | 表格的左上角操作区 | `<template #actions>...</template>` | `<ProTable><template #actions><Button type="primary">新建</Button></template></ProTable>` |
136
136
  | toolbar | 表格的右上角功能区 | `<template #toolbar>...</template>` | `<ProTable><template #toolbar><Button>自定义操作</Button></template></ProTable>` |
137
137
 
138
+ ### 插槽参数说明
139
+ **actions**
140
+
141
+ - 参数结构: 无参数
142
+
143
+ **toolbar**
144
+
145
+ - 参数结构: 无参数
146
+
138
147
  ## 相关组件
139
148
  Table, Search, SearchItems, PaginationPlus
140
149
 
@@ -44,6 +44,11 @@ const handleMouseLeave = (e: MouseEvent) => {
44
44
  | --- | --- | --- | --- |
45
45
  | icon | 自定义每一项评分图标,默认使用星形图标。 | `<template #icon>...</template>` | `<Rate v-model="score"><template #icon><Icon class="k-icon-favorite" /></template></Rate>` |
46
46
 
47
+ ### 插槽参数说明
48
+ **icon**
49
+
50
+ - 参数结构: 无参数
51
+
47
52
  ## 常见错误与正确用法 (Anti-Hallucination)
48
53
  ### 传入小数评分但未开启 half
49
54
  > **错误用法**: `<Rate :value="3.5" />`
@@ -0,0 +1,90 @@
1
+ # 滚动选择器 (ScrollSelect)
2
+
3
+ 滚动选择器组件,通过滚轮、拖拽或点击来选择值。适合时间、年份、数值区间等连续选项场景,也可以通过函数动态生成可选数据。
4
+
5
+ **关键词**: scrollselect, 滚动选择器, 时间滚轮, year picker
6
+
7
+ **使用场景**: 年份或月份选择、时间滚轮、连续数值选择
8
+
9
+ ## 导入语句
10
+ ```typescript
11
+ import { ScrollSelect } from '@king-design/vue';
12
+ ```
13
+
14
+ ## 属性 (Props)
15
+ | 属性名 | 类型 | 默认值 | 必填 | 说明 | 标签 | 示例 |
16
+ | --- | --- | --- | --- | --- | --- | --- |
17
+ | value | `T` | `undefined` | 否 | 当前选中值,可用 v-model 双向绑定 | - | `<ScrollSelect v-model="year" :data="years" />` |
18
+ | count | `number` | `5` | 否 | 可视区域中渲染的数据个数 | - | `<ScrollSelect :count="10" />` |
19
+ | data | `Data<T> = DataItem<T>[] | ((v: T) => DataItem<T>[])` | `[]` | 否 | 可选数据列表,或根据当前值动态生成数据的方法 | - | `<ScrollSelect :data="[{ value: 1, label: '一月' }]" />` |
20
+ | disabled | `boolean` | `false` | 否 | 是否禁用整个选择器 | - | `<ScrollSelect disabled :data="years" />` |
21
+ | disable | `(v: T) => boolean` | `undefined` | 否 | 按值控制单项是否禁用 | - | `<ScrollSelect :disable="(v) => v < 2020" />` |
22
+
23
+ ## 插槽 (Slots)
24
+ | 插槽名 | 说明 | 模板写法 | 示例 |
25
+ | --- | --- | --- | --- |
26
+ | append | 在滚动选择器后追加额外内容,例如单位说明 | `#append` | `<ScrollSelect v-model="hour" :data="hours"><template #append>时</template></ScrollSelect>` |
27
+
28
+ ### 插槽参数说明
29
+ **append**
30
+
31
+ - 参数结构: 无参数
32
+
33
+ ## 使用示例
34
+ ### 基础用法
35
+ **场景**: 在时间和数值选择场景中提供滚动选择交互。
36
+
37
+ 使用静态数据创建一个年份选择器。
38
+
39
+ **使用的 API**: 属性: value, data
40
+
41
+ ```vue
42
+ <script setup lang="ts">
43
+ import { ref } from 'vue';
44
+ import { ScrollSelect } from '@king-design/vue';
45
+
46
+ const year = ref(2024);
47
+ const years = Array.from({ length: 7 }, (_, index) => ({
48
+ value: 2021 + index,
49
+ label: `${2021 + index} 年`,
50
+ }));
51
+ </script>
52
+ <template>
53
+ <ScrollSelect v-model="year" :data="years" />
54
+ </template>
55
+ ```
56
+
57
+ ### 动态生成数据
58
+ **场景**: 在时间滚轮或区间选择中按需生成可见窗口数据。
59
+
60
+ 根据当前选中值动态生成附近的年份选项。
61
+
62
+ **使用的 API**: 属性: value, count, data | 插槽: append
63
+
64
+ ```vue
65
+ <script setup lang="ts">
66
+ import { ref } from 'vue';
67
+ import { ScrollSelect } from '@king-design/vue';
68
+
69
+ const currentYear = ref(2025);
70
+ const generateYears = (value: number) => {
71
+ const start = value - 3;
72
+ return Array.from({ length: 7 }, (_, index) => {
73
+ const year = start + index;
74
+ return {
75
+ value: year,
76
+ label: `${year} 年`,
77
+ };
78
+ });
79
+ };
80
+ </script>
81
+ <template>
82
+ <ScrollSelect v-model="currentYear" :count="7" :data="generateYears">
83
+ <template #append>年份</template>
84
+ </ScrollSelect>
85
+ </template>
86
+ ```
87
+
88
+ ## 相关组件
89
+ Datepicker, Timepicker
90
+
@@ -48,6 +48,58 @@ import { Select, Option, OptionGroup } from '@king-design/vue';
48
48
  | show | `@show` | 菜单弹出时触发 | `-` | `<Select @show="handleShow">` |
49
49
  | hide | `@hide` | 菜单隐藏时触发 | `-` | `<Select @hide="handleHide">` |
50
50
 
51
+ ## 插槽 (Slots)
52
+ | 插槽名 | 说明 | 模板写法 | 示例 |
53
+ | --- | --- | --- | --- |
54
+ | value | 自定义单选模式下的已选值展示内容 | `#value="[value, label]"` | `<Select v-model="selected">
55
+ <template #value="[value, label]">
56
+ <span>{{ label }} ({{ value }})</span>
57
+ </template>
58
+ </Select>` |
59
+ | values | 自定义多选模式下的已选值展示内容 | `#values="[values, labels]"` | `<Select v-model="selectedList" multiple>
60
+ <template #values="[values, labels]">
61
+ <span>已选 {{ labels.length }} 项</span>
62
+ </template>
63
+ </Select>` |
64
+ | prefix | 扩展选择框前缀内容 | `#prefix` | `<Select>
65
+ <template #prefix>
66
+ <span class="k-icon-search"></span>
67
+ </template>
68
+ </Select>` |
69
+ | suffix | 扩展选择框后缀内容 | `#suffix` | `<Select>
70
+ <template #suffix>
71
+ <span>自定义</span>
72
+ </template>
73
+ </Select>` |
74
+ | menu | 自定义整个下拉菜单区域 | `#menu` | `<Select>
75
+ <template #menu>
76
+ <div>自定义菜单内容</div>
77
+ </template>
78
+ </Select>` |
79
+
80
+ ### 插槽参数说明
81
+ **value**
82
+
83
+ - 参数结构: #value="[value, label]"
84
+ - 参数列表: `value: T`、`label: string`
85
+
86
+ **values**
87
+
88
+ - 参数结构: #values="[values, labels]"
89
+ - 参数列表: `values: T[]`、`labels: string[]`
90
+
91
+ **prefix**
92
+
93
+ - 参数结构: 无参数
94
+
95
+ **suffix**
96
+
97
+ - 参数结构: 无参数
98
+
99
+ **menu**
100
+
101
+ - 参数结构: 无参数
102
+
51
103
  ## 方法 (Methods)
52
104
  | 方法名 | 说明 | 参数 | 返回值 |
53
105
  | --- | --- | --- | --- |
@@ -55,25 +107,162 @@ import { Select, Option, OptionGroup } from '@king-design/vue';
55
107
  | hide | 主动关闭选择器下拉面板。 | `-` | `void` |
56
108
  | position | 重新计算当前选择器下拉面板的位置。 | `-` | `void` |
57
109
 
110
+ ### 方法调用示例
111
+ **show**
112
+
113
+ ```typescript
114
+ selectRef.value?.show();
115
+ ```
116
+
117
+ **hide**
118
+
119
+ ```typescript
120
+ selectRef.value?.hide();
121
+ ```
122
+
123
+ **position**
124
+
125
+ ```typescript
126
+ selectRef.value?.position();
127
+ ```
128
+
58
129
  ## 子组件 (Sub-Components)
59
130
  ### Option
60
131
  选项组件,用于定义下拉选项
61
132
 
133
+ #### 属性 (Props)
62
134
  | 属性名 | 类型 | 说明 | 示例 |
63
135
  | --- | --- | --- | --- |
64
136
  | value | `any` | 选中的值 | `<Option value="apple" label="苹果" />` |
65
137
  | label | `string` | 展示文案,同时也作为筛选的内容。不存在时使用 children 的文本 | `<Option value="apple" label="苹果" />` |
66
138
  | disabled | `boolean` | 是否禁用该项选择 | `<Option value="apple" label="苹果" disabled />` |
67
139
 
140
+ #### 组合示例
141
+ ##### 禁用选项
142
+ **场景**: 禁用下拉框中的某些选项
143
+
144
+ 禁用特定的选项
145
+
146
+ **命中的子组件 API**: 属性: value, label, disabled
147
+
148
+ ```vue
149
+ <script setup lang="ts">
150
+ import { ref } from 'vue';
151
+ import { Select, Option } from '@king-design/vue';
152
+
153
+ const selected = ref('');
154
+ </script>
155
+ <template>
156
+ <Select v-model="selected">
157
+ <Option value="apple" label="苹果" />
158
+ <Option value="orange" label="橙子" disabled />
159
+ <Option value="banana" label="香蕉" />
160
+ </Select>
161
+ </template>
162
+ ```
163
+
164
+ ##### 多选
165
+ **场景**: 创建一个支持多选的下拉框
166
+
167
+ 支持选择多个选项
168
+
169
+ **命中的子组件 API**: 属性: value, label
170
+
171
+ ```vue
172
+ <script setup lang="ts">
173
+ import { ref } from 'vue';
174
+ import { Select, Option } from '@king-design/vue';
175
+
176
+ const selected = ref<string[]>([]);
177
+ </script>
178
+ <template>
179
+ <Select v-model="selected" multiple placeholder="请选择多项">
180
+ <Option value="apple" label="苹果" />
181
+ <Option value="orange" label="橙子" />
182
+ <Option value="banana" label="香蕉" />
183
+ <Option value="grape" label="葡萄" />
184
+ </Select>
185
+ </template>
186
+ ```
187
+
188
+ ##### 可搜索
189
+ **场景**: 创建一个可以通过关键字搜索的下拉框
190
+
191
+ 可以通过输入关键字筛选选项
192
+
193
+ **命中的子组件 API**: 属性: value, label
194
+
195
+ ```vue
196
+ <script setup lang="ts">
197
+ import { ref } from 'vue';
198
+ import { Select, Option } from '@king-design/vue';
199
+
200
+ const selected = ref('');
201
+ </script>
202
+ <template>
203
+ <Select v-model="selected" filterable placeholder="输入关键字搜索">
204
+ <Option value="beijing" label="北京" />
205
+ <Option value="shanghai" label="上海" />
206
+ <Option value="guangzhou" label="广州" />
207
+ <Option value="shenzhen" label="深圳" />
208
+ </Select>
209
+ </template>
210
+ ```
211
+
68
212
  ### OptionGroup
69
213
  选项分组组件,用于对选项进行分组展示
70
214
 
215
+ #### 属性 (Props)
71
216
  | 属性名 | 类型 | 说明 | 示例 |
72
217
  | --- | --- | --- | --- |
73
218
  | label | `string | number | VNode` | 分组标签名 | `<OptionGroup label="水果">
74
219
  <Option value="apple" label="苹果" />
75
220
  </OptionGroup>` |
76
221
 
222
+ #### 插槽 (Slots)
223
+ | 插槽名 | 说明 | 模板写法 | 示例 |
224
+ | --- | --- | --- | --- |
225
+ | label | 自定义选项分组标题内容。 | `#label` | `<OptionGroup>
226
+ <template #label>
227
+ <span>水果分组</span>
228
+ </template>
229
+ <Option value="apple" label="苹果" />
230
+ </OptionGroup>` |
231
+
232
+ ##### 插槽参数说明
233
+ **label**
234
+
235
+ - 参数结构: 无参数
236
+
237
+ #### 组合示例
238
+ ##### 分组选项
239
+ **场景**: 创建带有分组的下拉选择框
240
+
241
+ 使用 OptionGroup 对选项进行分组
242
+
243
+ **命中的子组件 API**: 属性: label
244
+
245
+ ```vue
246
+ <script setup lang="ts">
247
+ import { ref } from 'vue';
248
+ import { Select, Option, OptionGroup } from '@king-design/vue';
249
+
250
+ const selected = ref('');
251
+ </script>
252
+ <template>
253
+ <Select v-model="selected" placeholder="请选择">
254
+ <OptionGroup label="水果">
255
+ <Option value="apple" label="苹果" />
256
+ <Option value="orange" label="橙子" />
257
+ </OptionGroup>
258
+ <OptionGroup label="蔬菜">
259
+ <Option value="tomato" label="番茄" />
260
+ <Option value="potato" label="土豆" />
261
+ </OptionGroup>
262
+ </Select>
263
+ </template>
264
+ ```
265
+
77
266
  ## 常见错误与正确用法 (Anti-Hallucination)
78
267
  ### 多选模式下 value 类型错误
79
268
  > **错误用法**: `const selected = ref('');
@@ -25,14 +25,49 @@ import { Skeleton, SkeletonItem } from '@king-design/vue';
25
25
  | --- | --- | --- | --- |
26
26
  | default | 自定义骨架内容。当 loading 为 true 时,默认插槽内容会作为骨架结构渲染。 | `<Skeleton :loading="loading">...</Skeleton>` | `<Skeleton :loading="loading"><div style="display:flex; gap:12px;"><SkeletonItem type="avator" /><div style="flex:1;"><SkeletonItem type="text" /><SkeletonItem type="text" /></div></div></Skeleton>` |
27
27
 
28
+ ### 插槽参数说明
29
+ **default**
30
+
31
+ - 参数结构: 无参数
32
+
28
33
  ## 子组件 (Sub-Components)
29
34
  ### SkeletonItem
30
35
  单个骨架项组件,用于组合更复杂的骨架布局。
31
36
 
37
+ #### 属性 (Props)
32
38
  | 属性名 | 类型 | 说明 | 示例 |
33
39
  | --- | --- | --- | --- |
34
40
  | type | `"text" | "avator" | "image" | "button" | "input"` | 骨架项类型。 | `<SkeletonItem type="image" />` |
35
41
 
42
+ #### 组合示例
43
+ ##### 自定义骨架布局
44
+ **场景**: 自定义复杂卡片骨架
45
+
46
+ 通过 SkeletonItem 自定义表单或卡片骨架。
47
+
48
+ **命中的子组件 API**: 属性: type
49
+
50
+ ```vue
51
+ <script setup lang="ts">
52
+ import { ref } from 'vue';
53
+ import { Skeleton, SkeletonItem } from '@king-design/vue';
54
+
55
+ const loading = ref(true);
56
+ </script>
57
+ <template>
58
+ <Skeleton :loading="loading">
59
+ <div style="display: flex; gap: 12px; align-items: flex-start;">
60
+ <SkeletonItem type="image" />
61
+ <div style="flex: 1; display: grid; gap: 8px;">
62
+ <SkeletonItem type="text" />
63
+ <SkeletonItem type="input" />
64
+ <SkeletonItem type="button" />
65
+ </div>
66
+ </div>
67
+ </Skeleton>
68
+ </template>
69
+ ```
70
+
36
71
  ## 常见错误与正确用法 (Anti-Hallucination)
37
72
  ### 误以为 Skeleton 会自动在 loading=false 时渲染真实内容
38
73
  > **错误用法**: `<Skeleton :loading="loading"><RealContent /></Skeleton>`
@@ -55,7 +55,17 @@ const handleChange = (newVal: number, oldVal: number) => {
55
55
  ## 插槽 (Slots)
56
56
  | 插槽名 | 说明 | 模板写法 | 示例 |
57
57
  | --- | --- | --- | --- |
58
- | tooltip | 当展示提示气泡,定义气泡的内容,和Tooltip组件行为一样,如果你传入空的内容,则不会展示气泡 | `undefined` | - |
58
+ | tooltip | 当展示提示气泡时,自定义气泡内容;参数为当前滑块值,范围模式下为当前指针对应的值。 | `<template #tooltip="value">...</template>` | `<Slider v-model="value" showTooltip>
59
+ <template #tooltip="value">
60
+ {{ value }}%
61
+ </template>
62
+ </Slider>` |
63
+
64
+ ### 插槽参数说明
65
+ **tooltip**
66
+
67
+ - 参数结构: <template #tooltip="value">...</template>
68
+ - 参数列表: `value: number | [number, number]`
59
69
 
60
70
  ## 常见错误与正确用法 (Anti-Hallucination)
61
71
  ### 范围选择时 value 类型错误
@@ -21,7 +21,16 @@ import { Spin } from '@king-design/vue';
21
21
  ## 插槽 (Slots)
22
22
  | 插槽名 | 说明 | 模板写法 | 示例 |
23
23
  | --- | --- | --- | --- |
24
- | canvas | 自定义旋转的元素内容 | `undefined` | - |
24
+ | canvas | 自定义旋转的元素内容 | `#canvas` | `<Spin>
25
+ <template #canvas>
26
+ 自定义canvas内容
27
+ </template>
28
+ </Spin>` |
29
+
30
+ ### 插槽参数说明
31
+ **canvas**
32
+
33
+ - 参数结构: 无参数
25
34
 
26
35
  ## 常见错误与正确用法 (Anti-Hallucination)
27
36
  ### 使用 center 但父元素无定位