king-design-analyzer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -0
- package/components/affix.json +178 -0
- package/components/az.json +86 -0
- package/components/badge.json +162 -0
- package/components/billtypes.json +90 -0
- package/components/breadcrumb.json +220 -0
- package/components/button.json +511 -0
- package/components/card.json +334 -0
- package/components/cardcontent.json +144 -0
- package/components/carousel.json +207 -0
- package/components/cascader.json +373 -0
- package/components/checkbox.json +298 -0
- package/components/code.json +318 -0
- package/components/collapse.json +358 -0
- package/components/copy.json +220 -0
- package/components/datepicker.json +529 -0
- package/components/descriptions.json +309 -0
- package/components/dialog.json +460 -0
- package/components/divider.json +287 -0
- package/components/drawer.json +563 -0
- package/components/dropdown.json +407 -0
- package/components/editable.json +331 -0
- package/components/ellipsis.json +218 -0
- package/components/form.json +638 -0
- package/components/grid.json +377 -0
- package/components/icon.json +442 -0
- package/components/input.json +821 -0
- package/components/layoutcontent.json +210 -0
- package/components/menu.json +482 -0
- package/components/message.json +345 -0
- package/components/pagination.json +444 -0
- package/components/paginationplus.json +74 -0
- package/components/popover.json +456 -0
- package/components/progress.json +354 -0
- package/components/protable.json +132 -0
- package/components/radio.json +246 -0
- package/components/region.json +115 -0
- package/components/select.json +676 -0
- package/components/slider.json +422 -0
- package/components/spin.json +232 -0
- package/components/spinner.json +441 -0
- package/components/status.json +75 -0
- package/components/steps.json +292 -0
- package/components/switch.json +357 -0
- package/components/table.json +1057 -0
- package/components/tablecolumnid.json +217 -0
- package/components/tabs.json +363 -0
- package/components/tag.json +504 -0
- package/components/timepicker.json +447 -0
- package/components/tip.json +322 -0
- package/components/tooltip.json +416 -0
- package/components/tour.json +395 -0
- package/components/transfer.json +414 -0
- package/components/tree.json +480 -0
- package/components/treeselect.json +478 -0
- package/components/upload.json +499 -0
- package/components/virtuallist.json +178 -0
- package/dist/ast/index.d.mts +71 -0
- package/dist/ast/index.d.ts +71 -0
- package/dist/ast/index.js +15 -0
- package/dist/ast/index.mjs +2 -0
- package/dist/chunk-4BUGNH4F.mjs +62 -0
- package/dist/chunk-5H7N2A5X.mjs +1 -0
- package/dist/chunk-5IF32MBB.js +603 -0
- package/dist/chunk-ARWRNWDW.js +219 -0
- package/dist/chunk-C3L4IXJC.mjs +577 -0
- package/dist/chunk-GNVCC37B.js +102 -0
- package/dist/chunk-N4UIA6DN.js +68 -0
- package/dist/chunk-RAMIBZAU.mjs +216 -0
- package/dist/chunk-RNQHI7YG.js +64 -0
- package/dist/chunk-TB6BF5TJ.mjs +99 -0
- package/dist/chunk-UX7KGX45.mjs +66 -0
- package/dist/chunk-YTEYDSDW.js +2 -0
- package/dist/full/index.d.mts +29 -0
- package/dist/full/index.d.ts +29 -0
- package/dist/full/index.js +16 -0
- package/dist/full/index.mjs +3 -0
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +43 -0
- package/dist/index.mjs +6 -0
- package/dist/runtime/index.d.mts +14 -0
- package/dist/runtime/index.d.ts +14 -0
- package/dist/runtime/index.js +15 -0
- package/dist/runtime/index.mjs +2 -0
- package/dist/sfcCompiler-m51JOfWs.d.mts +22 -0
- package/dist/sfcCompiler-m51JOfWs.d.ts +22 -0
- package/dist/static/index.d.mts +14 -0
- package/dist/static/index.d.ts +14 -0
- package/dist/static/index.js +19 -0
- package/dist/static/index.mjs +2 -0
- package/package.json +88 -0
|
@@ -0,0 +1,676 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "select",
|
|
3
|
+
"name": "Select",
|
|
4
|
+
"displayName": "选择框",
|
|
5
|
+
"category": "form",
|
|
6
|
+
"description": "下拉选择器组件,支持单选、多选、分组、搜索筛选、可创建新选项等功能。配合 Option 和 OptionGroup 子组件使用。",
|
|
7
|
+
"importStatement": "import { Select, Option, OptionGroup } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "value",
|
|
11
|
+
"description": "当前选择的元素,可用 v-model 双向绑定",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "any",
|
|
14
|
+
"kind": "custom"
|
|
15
|
+
},
|
|
16
|
+
"required": false,
|
|
17
|
+
"default": "\"\"",
|
|
18
|
+
"usageExample": "<Select v-model=\"selected\">"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "multiple",
|
|
22
|
+
"description": "是否支持多选",
|
|
23
|
+
"type": {
|
|
24
|
+
"raw": "boolean",
|
|
25
|
+
"kind": "boolean"
|
|
26
|
+
},
|
|
27
|
+
"required": false,
|
|
28
|
+
"default": "false",
|
|
29
|
+
"usageExample": "<Select v-model=\"selectedList\" multiple>"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "filterable",
|
|
33
|
+
"description": "是否支持筛选,输入时可过滤选项",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "boolean",
|
|
36
|
+
"kind": "boolean"
|
|
37
|
+
},
|
|
38
|
+
"required": false,
|
|
39
|
+
"default": "false",
|
|
40
|
+
"usageExample": "<Select v-model=\"selected\" filterable>"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "loading",
|
|
44
|
+
"description": "数据加载状态",
|
|
45
|
+
"type": {
|
|
46
|
+
"raw": "boolean",
|
|
47
|
+
"kind": "boolean"
|
|
48
|
+
},
|
|
49
|
+
"required": false,
|
|
50
|
+
"default": "false",
|
|
51
|
+
"usageExample": "<Select v-model=\"selected\" :loading=\"isLoading\">"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "disabled",
|
|
55
|
+
"description": "是否禁用",
|
|
56
|
+
"type": {
|
|
57
|
+
"raw": "boolean",
|
|
58
|
+
"kind": "boolean"
|
|
59
|
+
},
|
|
60
|
+
"required": false,
|
|
61
|
+
"default": "false",
|
|
62
|
+
"usageExample": "<Select disabled>"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "name",
|
|
66
|
+
"description": "表单元素的 name 属性",
|
|
67
|
+
"type": {
|
|
68
|
+
"raw": "string",
|
|
69
|
+
"kind": "string"
|
|
70
|
+
},
|
|
71
|
+
"required": false,
|
|
72
|
+
"default": "undefined",
|
|
73
|
+
"usageExample": "<Select name=\"city\">"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "size",
|
|
77
|
+
"description": "尺寸",
|
|
78
|
+
"type": {
|
|
79
|
+
"raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
|
|
80
|
+
"kind": "union",
|
|
81
|
+
"unionTypes": [
|
|
82
|
+
"large",
|
|
83
|
+
"default",
|
|
84
|
+
"small",
|
|
85
|
+
"mini"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"required": false,
|
|
89
|
+
"default": "\"default\"",
|
|
90
|
+
"allowedValues": [
|
|
91
|
+
{
|
|
92
|
+
"value": "large",
|
|
93
|
+
"label": "大尺寸"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"value": "default",
|
|
97
|
+
"label": "默认尺寸",
|
|
98
|
+
"isDefault": true
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"value": "small",
|
|
102
|
+
"label": "小尺寸"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"value": "mini",
|
|
106
|
+
"label": "迷你尺寸"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"usageExample": "<Select size=\"small\">"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "hideIcon",
|
|
113
|
+
"description": "是否隐藏后面的下拉图标",
|
|
114
|
+
"type": {
|
|
115
|
+
"raw": "boolean",
|
|
116
|
+
"kind": "boolean"
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"default": "false",
|
|
120
|
+
"usageExample": "<Select hideIcon>"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "clearable",
|
|
124
|
+
"description": "是否可清空已选内容",
|
|
125
|
+
"type": {
|
|
126
|
+
"raw": "boolean",
|
|
127
|
+
"kind": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"default": "false",
|
|
131
|
+
"usageExample": "<Select v-model=\"selected\" clearable>"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "fluid",
|
|
135
|
+
"description": "是否宽度 100%",
|
|
136
|
+
"type": {
|
|
137
|
+
"raw": "boolean",
|
|
138
|
+
"kind": "boolean"
|
|
139
|
+
},
|
|
140
|
+
"required": false,
|
|
141
|
+
"default": "false",
|
|
142
|
+
"usageExample": "<Select fluid>"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "inline",
|
|
146
|
+
"description": "展示内联模式,该模式下组件没有边框,宽度和高度由内容撑开",
|
|
147
|
+
"type": {
|
|
148
|
+
"raw": "boolean",
|
|
149
|
+
"kind": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"default": "false",
|
|
153
|
+
"usageExample": "<Select inline>"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "placeholder",
|
|
157
|
+
"description": "占位文案",
|
|
158
|
+
"type": {
|
|
159
|
+
"raw": "string",
|
|
160
|
+
"kind": "string"
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"default": "\"请选择\"",
|
|
164
|
+
"usageExample": "<Select placeholder=\"请选择城市\">"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "container",
|
|
168
|
+
"description": "指定弹出菜单追加的位置,默认 Dialog 组件会追加到 Dialog 中,其他追加到 body",
|
|
169
|
+
"type": {
|
|
170
|
+
"raw": "string | ((parentDom: Element, anchor: Node | null) => Element)",
|
|
171
|
+
"kind": "union"
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"default": "undefined",
|
|
175
|
+
"usageExample": "<Select :container=\"() => document.body\">"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "width",
|
|
179
|
+
"description": "指定宽度,组件自动添加单位 px",
|
|
180
|
+
"type": {
|
|
181
|
+
"raw": "number | string",
|
|
182
|
+
"kind": "union"
|
|
183
|
+
},
|
|
184
|
+
"required": false,
|
|
185
|
+
"default": "undefined",
|
|
186
|
+
"usageExample": "<Select :width=\"200\">"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "filter",
|
|
190
|
+
"description": "当支持筛选时,可以自定义筛选规则",
|
|
191
|
+
"type": {
|
|
192
|
+
"raw": "(keywords: string, props: any) => boolean",
|
|
193
|
+
"kind": "function",
|
|
194
|
+
"functionSignature": "(keywords: string, props: any) => boolean"
|
|
195
|
+
},
|
|
196
|
+
"required": false,
|
|
197
|
+
"default": "(keywords, props) => props.label.toLowerCase().includes(keywords) || props.value.toLowerCase().includes(keywords)",
|
|
198
|
+
"usageExample": "<Select filterable :filter=\"(kw, props) => props.label.includes(kw)\">"
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"name": "searchable",
|
|
202
|
+
"description": "是否在弹出菜单中展示搜索框",
|
|
203
|
+
"type": {
|
|
204
|
+
"raw": "boolean",
|
|
205
|
+
"kind": "boolean"
|
|
206
|
+
},
|
|
207
|
+
"required": false,
|
|
208
|
+
"default": "false",
|
|
209
|
+
"usageExample": "<Select searchable>"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "creatable",
|
|
213
|
+
"description": "是否支持创建新的选项,可以配合 filterable 使用",
|
|
214
|
+
"type": {
|
|
215
|
+
"raw": "boolean",
|
|
216
|
+
"kind": "boolean"
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"default": "false",
|
|
220
|
+
"usageExample": "<Select filterable creatable>"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"name": "labelMap",
|
|
224
|
+
"description": "建立 value 到 label 的映射,可以在 value 不在 Option 集合中时正确展示 label",
|
|
225
|
+
"type": {
|
|
226
|
+
"raw": "Map<any, string>",
|
|
227
|
+
"kind": "object"
|
|
228
|
+
},
|
|
229
|
+
"required": false,
|
|
230
|
+
"default": "new Map()",
|
|
231
|
+
"usageExample": "<Select :labelMap=\"new Map([['custom', '自定义选项']])\">"
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
"name": "card",
|
|
235
|
+
"description": "是否展示 card 模式",
|
|
236
|
+
"type": {
|
|
237
|
+
"raw": "boolean",
|
|
238
|
+
"kind": "boolean"
|
|
239
|
+
},
|
|
240
|
+
"required": false,
|
|
241
|
+
"default": "false",
|
|
242
|
+
"usageExample": "<Select card>"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "autoDisableArrow",
|
|
246
|
+
"description": "是否在没有更多可选项时,给箭头一个 disabled 状态来提示用户",
|
|
247
|
+
"type": {
|
|
248
|
+
"raw": "boolean",
|
|
249
|
+
"kind": "boolean"
|
|
250
|
+
},
|
|
251
|
+
"required": false,
|
|
252
|
+
"default": "false",
|
|
253
|
+
"usageExample": "<Select autoDisableArrow>"
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"name": "keepKeywords",
|
|
257
|
+
"description": "是否在选中选项后保留搜索关键字,配合 filterable 使用",
|
|
258
|
+
"type": {
|
|
259
|
+
"raw": "boolean",
|
|
260
|
+
"kind": "boolean"
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"default": "true",
|
|
264
|
+
"usageExample": "<Select filterable :keepKeywords=\"false\">"
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
"name": "show",
|
|
268
|
+
"description": "是否展示菜单项(受控模式)",
|
|
269
|
+
"type": {
|
|
270
|
+
"raw": "boolean",
|
|
271
|
+
"kind": "boolean"
|
|
272
|
+
},
|
|
273
|
+
"required": false,
|
|
274
|
+
"default": "false",
|
|
275
|
+
"usageExample": "<Select :show=\"isMenuVisible\">"
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
"name": "position",
|
|
279
|
+
"description": "菜单弹出的位置",
|
|
280
|
+
"type": {
|
|
281
|
+
"raw": "Position | \"left\" | \"bottom\" | \"right\" | \"top\"",
|
|
282
|
+
"kind": "union",
|
|
283
|
+
"unionTypes": [
|
|
284
|
+
"left",
|
|
285
|
+
"bottom",
|
|
286
|
+
"right",
|
|
287
|
+
"top"
|
|
288
|
+
]
|
|
289
|
+
},
|
|
290
|
+
"required": false,
|
|
291
|
+
"default": "{my: 'left top+8', at: 'left bottom'}",
|
|
292
|
+
"usageExample": "<Select position=\"top\">"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
"name": "flat",
|
|
296
|
+
"description": "是否展示扁平样式",
|
|
297
|
+
"type": {
|
|
298
|
+
"raw": "boolean",
|
|
299
|
+
"kind": "boolean"
|
|
300
|
+
},
|
|
301
|
+
"required": false,
|
|
302
|
+
"default": "false",
|
|
303
|
+
"usageExample": "<Select flat>"
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"name": "draggable",
|
|
307
|
+
"description": "多选值是否支持拖动排序",
|
|
308
|
+
"type": {
|
|
309
|
+
"raw": "boolean",
|
|
310
|
+
"kind": "boolean"
|
|
311
|
+
},
|
|
312
|
+
"required": false,
|
|
313
|
+
"default": "false",
|
|
314
|
+
"usageExample": "<Select multiple draggable>"
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"name": "virtual",
|
|
318
|
+
"description": "是否开启虚拟列表,用于大数据量场景",
|
|
319
|
+
"type": {
|
|
320
|
+
"raw": "boolean",
|
|
321
|
+
"kind": "boolean"
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"default": "false",
|
|
325
|
+
"usageExample": "<Select virtual>"
|
|
326
|
+
}
|
|
327
|
+
],
|
|
328
|
+
"events": [
|
|
329
|
+
{
|
|
330
|
+
"name": "show",
|
|
331
|
+
"vueEventName": "@show",
|
|
332
|
+
"description": "菜单弹出时触发",
|
|
333
|
+
"payload": [],
|
|
334
|
+
"usageExample": "<Select @show=\"handleShow\">",
|
|
335
|
+
"handlerExample": "const handleShow = () => {\n console.log('下拉菜单已展开');\n};"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "hide",
|
|
339
|
+
"vueEventName": "@hide",
|
|
340
|
+
"description": "菜单隐藏时触发",
|
|
341
|
+
"payload": [],
|
|
342
|
+
"usageExample": "<Select @hide=\"handleHide\">",
|
|
343
|
+
"handlerExample": "const handleHide = () => {\n console.log('下拉菜单已关闭');\n};"
|
|
344
|
+
}
|
|
345
|
+
],
|
|
346
|
+
"slots": [
|
|
347
|
+
{
|
|
348
|
+
"name": "value",
|
|
349
|
+
"description": "自定义选择结果的展示",
|
|
350
|
+
"params": "([value: any, label: Children]) => Children"
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
"name": "values",
|
|
354
|
+
"description": "自定义多选的选择结果的展示",
|
|
355
|
+
"params": "([values: any[], labels: Children[]]) => Children"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"name": "prefix",
|
|
359
|
+
"description": "自定义输入框前面展示的内容"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "suffix",
|
|
363
|
+
"description": "自定义输入框后面展示的内容"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"name": "menu",
|
|
367
|
+
"description": "自定义整个菜单的内容"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"methods": [],
|
|
371
|
+
"subComponents": [
|
|
372
|
+
{
|
|
373
|
+
"name": "Option",
|
|
374
|
+
"description": "选项组件,用于定义下拉选项",
|
|
375
|
+
"props": [
|
|
376
|
+
{
|
|
377
|
+
"name": "value",
|
|
378
|
+
"description": "选中的值",
|
|
379
|
+
"type": {
|
|
380
|
+
"raw": "any",
|
|
381
|
+
"kind": "custom"
|
|
382
|
+
},
|
|
383
|
+
"required": false,
|
|
384
|
+
"default": "undefined",
|
|
385
|
+
"usageExample": "<Option value=\"apple\" label=\"苹果\" />"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "label",
|
|
389
|
+
"description": "展示文案,同时也作为筛选的内容。不存在时使用 children 的文本",
|
|
390
|
+
"type": {
|
|
391
|
+
"raw": "string",
|
|
392
|
+
"kind": "string"
|
|
393
|
+
},
|
|
394
|
+
"required": false,
|
|
395
|
+
"default": "undefined",
|
|
396
|
+
"usageExample": "<Option value=\"apple\" label=\"苹果\" />"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"name": "disabled",
|
|
400
|
+
"description": "是否禁用该项选择",
|
|
401
|
+
"type": {
|
|
402
|
+
"raw": "boolean",
|
|
403
|
+
"kind": "boolean"
|
|
404
|
+
},
|
|
405
|
+
"required": false,
|
|
406
|
+
"default": "false",
|
|
407
|
+
"usageExample": "<Option value=\"apple\" label=\"苹果\" disabled />"
|
|
408
|
+
}
|
|
409
|
+
]
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "OptionGroup",
|
|
413
|
+
"description": "选项分组组件,用于对选项进行分组展示",
|
|
414
|
+
"props": [
|
|
415
|
+
{
|
|
416
|
+
"name": "label",
|
|
417
|
+
"description": "分组标签名",
|
|
418
|
+
"type": {
|
|
419
|
+
"raw": "string | number | VNode",
|
|
420
|
+
"kind": "union"
|
|
421
|
+
},
|
|
422
|
+
"required": false,
|
|
423
|
+
"default": "undefined",
|
|
424
|
+
"usageExample": "<OptionGroup label=\"水果\">\n <Option value=\"apple\" label=\"苹果\" />\n</OptionGroup>"
|
|
425
|
+
}
|
|
426
|
+
],
|
|
427
|
+
"slots": [
|
|
428
|
+
{
|
|
429
|
+
"name": "label",
|
|
430
|
+
"description": "定义复杂的分组标签名"
|
|
431
|
+
}
|
|
432
|
+
]
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
"typeDefinitions": [
|
|
436
|
+
{
|
|
437
|
+
"name": "Position",
|
|
438
|
+
"definition": "type Position = {\n my?: string | [string, string]\n at?: string | [string, string]\n collision?: Collision | [Collision, Collision]\n collisionDirection?: ['left'] | ['top'] | ['left', 'top']\n}",
|
|
439
|
+
"description": "菜单弹出位置配置"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"name": "Collision",
|
|
443
|
+
"definition": "type Collision = 'fit' | 'flip' | 'flipfit' | 'none'",
|
|
444
|
+
"description": "碰撞检测行为"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"name": "Container",
|
|
448
|
+
"definition": "type Container = string | ((parentDom: Element, anchor: Node | null) => Element)",
|
|
449
|
+
"description": "容器类型,可以是选择器字符串或返回元素的函数"
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
"examples": [
|
|
453
|
+
{
|
|
454
|
+
"id": "select_basic",
|
|
455
|
+
"title": "基础用法",
|
|
456
|
+
"description": "基本的下拉选择框",
|
|
457
|
+
"difficulty": "easy",
|
|
458
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('');\n</script>\n<template>\n <Select v-model=\"selected\" placeholder=\"请选择\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n <Option value=\"banana\" label=\"香蕉\" />\n </Select>\n</template>",
|
|
459
|
+
"tags": [
|
|
460
|
+
"basic",
|
|
461
|
+
"single"
|
|
462
|
+
],
|
|
463
|
+
"usedProps": [
|
|
464
|
+
"value",
|
|
465
|
+
"placeholder"
|
|
466
|
+
],
|
|
467
|
+
"usedEvents": [],
|
|
468
|
+
"usedMethods": [],
|
|
469
|
+
"scenario": "创建一个基本的单选下拉框"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"id": "select_multiple",
|
|
473
|
+
"title": "多选",
|
|
474
|
+
"description": "支持选择多个选项",
|
|
475
|
+
"difficulty": "easy",
|
|
476
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref<string[]>([]);\n</script>\n<template>\n <Select v-model=\"selected\" multiple placeholder=\"请选择多项\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n <Option value=\"banana\" label=\"香蕉\" />\n <Option value=\"grape\" label=\"葡萄\" />\n </Select>\n</template>",
|
|
477
|
+
"tags": [
|
|
478
|
+
"multiple",
|
|
479
|
+
"multi-select"
|
|
480
|
+
],
|
|
481
|
+
"usedProps": [
|
|
482
|
+
"value",
|
|
483
|
+
"multiple",
|
|
484
|
+
"placeholder"
|
|
485
|
+
],
|
|
486
|
+
"usedEvents": [],
|
|
487
|
+
"usedMethods": [],
|
|
488
|
+
"scenario": "创建一个支持多选的下拉框"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"id": "select_filterable",
|
|
492
|
+
"title": "可搜索",
|
|
493
|
+
"description": "可以通过输入关键字筛选选项",
|
|
494
|
+
"difficulty": "easy",
|
|
495
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('');\n</script>\n<template>\n <Select v-model=\"selected\" filterable placeholder=\"输入关键字搜索\">\n <Option value=\"beijing\" label=\"北京\" />\n <Option value=\"shanghai\" label=\"上海\" />\n <Option value=\"guangzhou\" label=\"广州\" />\n <Option value=\"shenzhen\" label=\"深圳\" />\n </Select>\n</template>",
|
|
496
|
+
"tags": [
|
|
497
|
+
"filterable",
|
|
498
|
+
"search",
|
|
499
|
+
"filter"
|
|
500
|
+
],
|
|
501
|
+
"usedProps": [
|
|
502
|
+
"value",
|
|
503
|
+
"filterable",
|
|
504
|
+
"placeholder"
|
|
505
|
+
],
|
|
506
|
+
"usedEvents": [],
|
|
507
|
+
"usedMethods": [],
|
|
508
|
+
"scenario": "创建一个可以通过关键字搜索的下拉框"
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"id": "select_clearable",
|
|
512
|
+
"title": "可清空",
|
|
513
|
+
"description": "支持一键清空已选内容",
|
|
514
|
+
"difficulty": "easy",
|
|
515
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('apple');\n</script>\n<template>\n <Select v-model=\"selected\" clearable>\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n </Select>\n</template>",
|
|
516
|
+
"tags": [
|
|
517
|
+
"clearable",
|
|
518
|
+
"clear"
|
|
519
|
+
],
|
|
520
|
+
"usedProps": [
|
|
521
|
+
"value",
|
|
522
|
+
"clearable"
|
|
523
|
+
],
|
|
524
|
+
"usedEvents": [],
|
|
525
|
+
"usedMethods": [],
|
|
526
|
+
"scenario": "创建一个可以清空已选值的下拉框"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"id": "select_group",
|
|
530
|
+
"title": "分组选项",
|
|
531
|
+
"description": "使用 OptionGroup 对选项进行分组",
|
|
532
|
+
"difficulty": "medium",
|
|
533
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option, OptionGroup } from '@king-design/vue';\n\nconst selected = ref('');\n</script>\n<template>\n <Select v-model=\"selected\" placeholder=\"请选择\">\n <OptionGroup label=\"水果\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n </OptionGroup>\n <OptionGroup label=\"蔬菜\">\n <Option value=\"tomato\" label=\"番茄\" />\n <Option value=\"potato\" label=\"土豆\" />\n </OptionGroup>\n </Select>\n</template>",
|
|
534
|
+
"tags": [
|
|
535
|
+
"group",
|
|
536
|
+
"OptionGroup",
|
|
537
|
+
"category"
|
|
538
|
+
],
|
|
539
|
+
"usedProps": [
|
|
540
|
+
"value",
|
|
541
|
+
"placeholder"
|
|
542
|
+
],
|
|
543
|
+
"usedEvents": [],
|
|
544
|
+
"usedMethods": [],
|
|
545
|
+
"scenario": "创建带有分组的下拉选择框"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"id": "select_disabled_option",
|
|
549
|
+
"title": "禁用选项",
|
|
550
|
+
"description": "禁用特定的选项",
|
|
551
|
+
"difficulty": "easy",
|
|
552
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('');\n</script>\n<template>\n <Select v-model=\"selected\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" disabled />\n <Option value=\"banana\" label=\"香蕉\" />\n </Select>\n</template>",
|
|
553
|
+
"tags": [
|
|
554
|
+
"disabled",
|
|
555
|
+
"option"
|
|
556
|
+
],
|
|
557
|
+
"usedProps": [
|
|
558
|
+
"value"
|
|
559
|
+
],
|
|
560
|
+
"usedEvents": [],
|
|
561
|
+
"usedMethods": [],
|
|
562
|
+
"scenario": "禁用下拉框中的某些选项"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"id": "select_creatable",
|
|
566
|
+
"title": "可创建选项",
|
|
567
|
+
"description": "允许用户创建新的选项",
|
|
568
|
+
"difficulty": "medium",
|
|
569
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('');\n</script>\n<template>\n <Select v-model=\"selected\" filterable creatable placeholder=\"可输入创建新选项\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n </Select>\n</template>",
|
|
570
|
+
"tags": [
|
|
571
|
+
"creatable",
|
|
572
|
+
"create",
|
|
573
|
+
"filterable"
|
|
574
|
+
],
|
|
575
|
+
"usedProps": [
|
|
576
|
+
"value",
|
|
577
|
+
"filterable",
|
|
578
|
+
"creatable",
|
|
579
|
+
"placeholder"
|
|
580
|
+
],
|
|
581
|
+
"usedEvents": [],
|
|
582
|
+
"usedMethods": [],
|
|
583
|
+
"scenario": "创建一个允许用户输入新选项的下拉框"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
"id": "select_loading",
|
|
587
|
+
"title": "加载状态",
|
|
588
|
+
"description": "展示数据加载中的状态",
|
|
589
|
+
"difficulty": "easy",
|
|
590
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Select, Option } from '@king-design/vue';\n\nconst selected = ref('');\nconst loading = ref(true);\n\n// 模拟异步加载\nsetTimeout(() => {\n loading.value = false;\n}, 2000);\n</script>\n<template>\n <Select v-model=\"selected\" :loading=\"loading\" placeholder=\"加载中...\">\n <Option value=\"apple\" label=\"苹果\" />\n <Option value=\"orange\" label=\"橙子\" />\n </Select>\n</template>",
|
|
591
|
+
"tags": [
|
|
592
|
+
"loading",
|
|
593
|
+
"async"
|
|
594
|
+
],
|
|
595
|
+
"usedProps": [
|
|
596
|
+
"value",
|
|
597
|
+
"loading",
|
|
598
|
+
"placeholder"
|
|
599
|
+
],
|
|
600
|
+
"usedEvents": [],
|
|
601
|
+
"usedMethods": [],
|
|
602
|
+
"scenario": "展示异步加载数据时的加载状态"
|
|
603
|
+
}
|
|
604
|
+
],
|
|
605
|
+
"commonMistakes": [
|
|
606
|
+
{
|
|
607
|
+
"id": "select_multiple_type",
|
|
608
|
+
"description": "多选模式下 value 类型错误",
|
|
609
|
+
"wrongCode": "const selected = ref('');\n<Select v-model=\"selected\" multiple>",
|
|
610
|
+
"correctCode": "const selected = ref<string[]>([]);\n<Select v-model=\"selected\" multiple>",
|
|
611
|
+
"explanation": "使用 multiple 多选模式时,value 必须是数组类型,而非字符串",
|
|
612
|
+
"relatedProps": [
|
|
613
|
+
"multiple",
|
|
614
|
+
"value"
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"id": "select_option_value",
|
|
619
|
+
"description": "Option 未设置 value 属性",
|
|
620
|
+
"wrongCode": "<Select v-model=\"selected\">\n <Option label=\"苹果\" />\n</Select>",
|
|
621
|
+
"correctCode": "<Select v-model=\"selected\">\n <Option value=\"apple\" label=\"苹果\" />\n</Select>",
|
|
622
|
+
"explanation": "Option 必须设置 value 属性,否则无法正确绑定选中值",
|
|
623
|
+
"relatedProps": [
|
|
624
|
+
"value"
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
{
|
|
628
|
+
"id": "select_size_typo",
|
|
629
|
+
"description": "使用不存在的 size 值 (Select)",
|
|
630
|
+
"wrongCode": "<Select size=\"medium\">",
|
|
631
|
+
"correctCode": "<Select size=\"default\">",
|
|
632
|
+
"explanation": "Select 的 size 只支持 large, default, small, mini。常见错误是使用 medium 值。",
|
|
633
|
+
"relatedProps": [
|
|
634
|
+
"size"
|
|
635
|
+
]
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"id": "select_creatable_without_filterable",
|
|
639
|
+
"description": "使用 creatable 但未启用 filterable",
|
|
640
|
+
"wrongCode": "<Select creatable>",
|
|
641
|
+
"correctCode": "<Select filterable creatable>",
|
|
642
|
+
"explanation": "creatable 属性需要配合 filterable 使用,因为创建新选项需要用户输入",
|
|
643
|
+
"relatedProps": [
|
|
644
|
+
"filterable",
|
|
645
|
+
"creatable"
|
|
646
|
+
]
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
"searchKeywords": [
|
|
650
|
+
"选择框",
|
|
651
|
+
"select",
|
|
652
|
+
"下拉",
|
|
653
|
+
"dropdown",
|
|
654
|
+
"option",
|
|
655
|
+
"多选",
|
|
656
|
+
"multiple",
|
|
657
|
+
"筛选",
|
|
658
|
+
"filterable",
|
|
659
|
+
"分组",
|
|
660
|
+
"OptionGroup"
|
|
661
|
+
],
|
|
662
|
+
"useCases": [
|
|
663
|
+
"表单中的下拉选择",
|
|
664
|
+
"城市/地区选择器",
|
|
665
|
+
"多标签选择",
|
|
666
|
+
"分类筛选器",
|
|
667
|
+
"动态加载选项",
|
|
668
|
+
"可创建新选项的标签选择"
|
|
669
|
+
],
|
|
670
|
+
"relatedComponents": [
|
|
671
|
+
"Option",
|
|
672
|
+
"OptionGroup",
|
|
673
|
+
"Cascader",
|
|
674
|
+
"TreeSelect"
|
|
675
|
+
]
|
|
676
|
+
}
|