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.
Files changed (92) hide show
  1. package/README.md +151 -0
  2. package/components/affix.json +178 -0
  3. package/components/az.json +86 -0
  4. package/components/badge.json +162 -0
  5. package/components/billtypes.json +90 -0
  6. package/components/breadcrumb.json +220 -0
  7. package/components/button.json +511 -0
  8. package/components/card.json +334 -0
  9. package/components/cardcontent.json +144 -0
  10. package/components/carousel.json +207 -0
  11. package/components/cascader.json +373 -0
  12. package/components/checkbox.json +298 -0
  13. package/components/code.json +318 -0
  14. package/components/collapse.json +358 -0
  15. package/components/copy.json +220 -0
  16. package/components/datepicker.json +529 -0
  17. package/components/descriptions.json +309 -0
  18. package/components/dialog.json +460 -0
  19. package/components/divider.json +287 -0
  20. package/components/drawer.json +563 -0
  21. package/components/dropdown.json +407 -0
  22. package/components/editable.json +331 -0
  23. package/components/ellipsis.json +218 -0
  24. package/components/form.json +638 -0
  25. package/components/grid.json +377 -0
  26. package/components/icon.json +442 -0
  27. package/components/input.json +821 -0
  28. package/components/layoutcontent.json +210 -0
  29. package/components/menu.json +482 -0
  30. package/components/message.json +345 -0
  31. package/components/pagination.json +444 -0
  32. package/components/paginationplus.json +74 -0
  33. package/components/popover.json +456 -0
  34. package/components/progress.json +354 -0
  35. package/components/protable.json +132 -0
  36. package/components/radio.json +246 -0
  37. package/components/region.json +115 -0
  38. package/components/select.json +676 -0
  39. package/components/slider.json +422 -0
  40. package/components/spin.json +232 -0
  41. package/components/spinner.json +441 -0
  42. package/components/status.json +75 -0
  43. package/components/steps.json +292 -0
  44. package/components/switch.json +357 -0
  45. package/components/table.json +1057 -0
  46. package/components/tablecolumnid.json +217 -0
  47. package/components/tabs.json +363 -0
  48. package/components/tag.json +504 -0
  49. package/components/timepicker.json +447 -0
  50. package/components/tip.json +322 -0
  51. package/components/tooltip.json +416 -0
  52. package/components/tour.json +395 -0
  53. package/components/transfer.json +414 -0
  54. package/components/tree.json +480 -0
  55. package/components/treeselect.json +478 -0
  56. package/components/upload.json +499 -0
  57. package/components/virtuallist.json +178 -0
  58. package/dist/ast/index.d.mts +71 -0
  59. package/dist/ast/index.d.ts +71 -0
  60. package/dist/ast/index.js +15 -0
  61. package/dist/ast/index.mjs +2 -0
  62. package/dist/chunk-4BUGNH4F.mjs +62 -0
  63. package/dist/chunk-5H7N2A5X.mjs +1 -0
  64. package/dist/chunk-5IF32MBB.js +603 -0
  65. package/dist/chunk-ARWRNWDW.js +219 -0
  66. package/dist/chunk-C3L4IXJC.mjs +577 -0
  67. package/dist/chunk-GNVCC37B.js +102 -0
  68. package/dist/chunk-N4UIA6DN.js +68 -0
  69. package/dist/chunk-RAMIBZAU.mjs +216 -0
  70. package/dist/chunk-RNQHI7YG.js +64 -0
  71. package/dist/chunk-TB6BF5TJ.mjs +99 -0
  72. package/dist/chunk-UX7KGX45.mjs +66 -0
  73. package/dist/chunk-YTEYDSDW.js +2 -0
  74. package/dist/full/index.d.mts +29 -0
  75. package/dist/full/index.d.ts +29 -0
  76. package/dist/full/index.js +16 -0
  77. package/dist/full/index.mjs +3 -0
  78. package/dist/index.d.mts +5 -0
  79. package/dist/index.d.ts +5 -0
  80. package/dist/index.js +43 -0
  81. package/dist/index.mjs +6 -0
  82. package/dist/runtime/index.d.mts +14 -0
  83. package/dist/runtime/index.d.ts +14 -0
  84. package/dist/runtime/index.js +15 -0
  85. package/dist/runtime/index.mjs +2 -0
  86. package/dist/sfcCompiler-m51JOfWs.d.mts +22 -0
  87. package/dist/sfcCompiler-m51JOfWs.d.ts +22 -0
  88. package/dist/static/index.d.mts +14 -0
  89. package/dist/static/index.d.ts +14 -0
  90. package/dist/static/index.js +19 -0
  91. package/dist/static/index.mjs +2 -0
  92. package/package.json +88 -0
@@ -0,0 +1,821 @@
1
+ {
2
+ "id": "input",
3
+ "name": "Input",
4
+ "displayName": "输入框",
5
+ "category": "form",
6
+ "description": "用于文本输入的表单组件,支持单行文本、多行文本域,可配合前后缀、清除按钮等功能使用。还提供了 Search 搜索组件。",
7
+ "importStatement": "import { Input, Search } from '@king-design/vue';",
8
+ "props": [
9
+ {
10
+ "name": "type",
11
+ "description": "在原生 input 标签的 type 取值的基础上扩展了 textarea 值,当取该值时渲染成 <textarea>",
12
+ "type": {
13
+ "raw": "string",
14
+ "kind": "string"
15
+ },
16
+ "required": false,
17
+ "default": "\"text\"",
18
+ "allowedValues": [
19
+ {
20
+ "value": "text",
21
+ "label": "普通文本输入",
22
+ "isDefault": true
23
+ },
24
+ {
25
+ "value": "password",
26
+ "label": "密码输入"
27
+ },
28
+ {
29
+ "value": "number",
30
+ "label": "数字输入"
31
+ },
32
+ {
33
+ "value": "email",
34
+ "label": "邮箱输入"
35
+ },
36
+ {
37
+ "value": "tel",
38
+ "label": "电话输入"
39
+ },
40
+ {
41
+ "value": "url",
42
+ "label": "URL 输入"
43
+ },
44
+ {
45
+ "value": "textarea",
46
+ "label": "多行文本域(扩展值)"
47
+ }
48
+ ],
49
+ "usageExample": "<Input type=\"textarea\" :rows=\"4\" placeholder=\"请输入内容\" />"
50
+ },
51
+ {
52
+ "name": "value",
53
+ "description": "输入框的值,可用 v-model 进行双向绑定",
54
+ "type": {
55
+ "raw": "string",
56
+ "kind": "string"
57
+ },
58
+ "required": false,
59
+ "default": "undefined",
60
+ "usageExample": "<Input v-model=\"inputValue\" />"
61
+ },
62
+ {
63
+ "name": "defaultValue",
64
+ "description": "input 的 defaultValue,首次渲染使用该值",
65
+ "type": {
66
+ "raw": "string",
67
+ "kind": "string"
68
+ },
69
+ "required": false,
70
+ "default": "undefined",
71
+ "usageExample": "<Input defaultValue=\"初始值\" />"
72
+ },
73
+ {
74
+ "name": "name",
75
+ "description": "原生 input 标签的 name 属性",
76
+ "type": {
77
+ "raw": "string",
78
+ "kind": "string"
79
+ },
80
+ "required": false,
81
+ "default": "undefined",
82
+ "usageExample": "<Input name=\"username\" />"
83
+ },
84
+ {
85
+ "name": "placeholder",
86
+ "description": "占位文案",
87
+ "type": {
88
+ "raw": "string",
89
+ "kind": "string"
90
+ },
91
+ "required": false,
92
+ "default": "undefined",
93
+ "usageExample": "<Input placeholder=\"请输入内容\" />"
94
+ },
95
+ {
96
+ "name": "readonly",
97
+ "description": "是否只读",
98
+ "type": {
99
+ "raw": "boolean",
100
+ "kind": "boolean"
101
+ },
102
+ "required": false,
103
+ "default": "false",
104
+ "usageExample": "<Input v-model=\"value\" readonly />"
105
+ },
106
+ {
107
+ "name": "clearable",
108
+ "description": "是否展示快速清除按钮",
109
+ "type": {
110
+ "raw": "boolean",
111
+ "kind": "boolean"
112
+ },
113
+ "required": false,
114
+ "default": "false",
115
+ "usageExample": "<Input v-model=\"value\" clearable />"
116
+ },
117
+ {
118
+ "name": "disabled",
119
+ "description": "是否禁用",
120
+ "type": {
121
+ "raw": "boolean",
122
+ "kind": "boolean"
123
+ },
124
+ "required": false,
125
+ "default": "false",
126
+ "usageExample": "<Input disabled placeholder=\"禁用状态\" />"
127
+ },
128
+ {
129
+ "name": "size",
130
+ "description": "组件尺寸",
131
+ "type": {
132
+ "raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
133
+ "kind": "union",
134
+ "unionTypes": [
135
+ "large",
136
+ "default",
137
+ "small",
138
+ "mini"
139
+ ]
140
+ },
141
+ "required": false,
142
+ "default": "\"default\"",
143
+ "allowedValues": [
144
+ {
145
+ "value": "large",
146
+ "label": "大尺寸"
147
+ },
148
+ {
149
+ "value": "default",
150
+ "label": "默认尺寸",
151
+ "isDefault": true
152
+ },
153
+ {
154
+ "value": "small",
155
+ "label": "小尺寸"
156
+ },
157
+ {
158
+ "value": "mini",
159
+ "label": "迷你尺寸"
160
+ }
161
+ ],
162
+ "usageExample": "<Input size=\"large\" placeholder=\"大尺寸输入框\" />"
163
+ },
164
+ {
165
+ "name": "rows",
166
+ "description": "当 type=\"textarea\" 时,默认展示文本行数",
167
+ "type": {
168
+ "raw": "number | string",
169
+ "kind": "union"
170
+ },
171
+ "required": false,
172
+ "default": "2",
173
+ "usageExample": "<Input type=\"textarea\" :rows=\"6\" />"
174
+ },
175
+ {
176
+ "name": "autoWidth",
177
+ "description": "是否宽度随输入的文本的长度变化而变化",
178
+ "type": {
179
+ "raw": "boolean",
180
+ "kind": "boolean"
181
+ },
182
+ "required": false,
183
+ "default": "false",
184
+ "usageExample": "<Input autoWidth placeholder=\"宽度自适应\" />"
185
+ },
186
+ {
187
+ "name": "fluid",
188
+ "description": "是否宽度 100%",
189
+ "type": {
190
+ "raw": "boolean",
191
+ "kind": "boolean"
192
+ },
193
+ "required": false,
194
+ "default": "false",
195
+ "usageExample": "<Input fluid placeholder=\"宽度100%\" />"
196
+ },
197
+ {
198
+ "name": "width",
199
+ "description": "指定宽度,组件会加上单位 px",
200
+ "type": {
201
+ "raw": "string | number",
202
+ "kind": "union"
203
+ },
204
+ "required": false,
205
+ "default": "undefined",
206
+ "usageExample": "<Input :width=\"300\" placeholder=\"宽度300px\" />"
207
+ },
208
+ {
209
+ "name": "stackClearIcon",
210
+ "description": "是否将清空按钮覆盖在 suffix 按钮上展示来节省空间",
211
+ "type": {
212
+ "raw": "boolean",
213
+ "kind": "boolean"
214
+ },
215
+ "required": false,
216
+ "default": "false",
217
+ "usageExample": "<Input clearable stackClearIcon />"
218
+ },
219
+ {
220
+ "name": "frozenOnInput",
221
+ "description": "是否在输入的过程中冻结 value 更新到视图",
222
+ "type": {
223
+ "raw": "boolean",
224
+ "kind": "boolean"
225
+ },
226
+ "required": false,
227
+ "default": "false",
228
+ "usageExample": "<Input frozenOnInput />"
229
+ },
230
+ {
231
+ "name": "inline",
232
+ "description": "是否展示内联模式",
233
+ "type": {
234
+ "raw": "boolean",
235
+ "kind": "boolean"
236
+ },
237
+ "required": false,
238
+ "default": "false",
239
+ "usageExample": "<Input inline />"
240
+ },
241
+ {
242
+ "name": "resize",
243
+ "description": "指定 textarea 输入框拖动调整大小的方向,默认只能垂直方向调整",
244
+ "type": {
245
+ "raw": "\"none\" | \"vertical\" | \"horizontal\" | \"both\"",
246
+ "kind": "union",
247
+ "unionTypes": [
248
+ "none",
249
+ "vertical",
250
+ "horizontal",
251
+ "both"
252
+ ]
253
+ },
254
+ "required": false,
255
+ "default": "\"vertical\"",
256
+ "allowedValues": [
257
+ {
258
+ "value": "none",
259
+ "label": "禁止调整大小"
260
+ },
261
+ {
262
+ "value": "vertical",
263
+ "label": "只能垂直调整",
264
+ "isDefault": true
265
+ },
266
+ {
267
+ "value": "horizontal",
268
+ "label": "只能水平调整"
269
+ },
270
+ {
271
+ "value": "both",
272
+ "label": "可双向调整"
273
+ }
274
+ ],
275
+ "usageExample": "<Input type=\"textarea\" resize=\"both\" />"
276
+ },
277
+ {
278
+ "name": "flat",
279
+ "description": "是否展示扁平样式",
280
+ "type": {
281
+ "raw": "boolean",
282
+ "kind": "boolean"
283
+ },
284
+ "required": false,
285
+ "default": "false",
286
+ "usageExample": "<Input flat placeholder=\"扁平样式\" />"
287
+ },
288
+ {
289
+ "name": "showCount",
290
+ "description": "是否展示字符长度提示数字",
291
+ "type": {
292
+ "raw": "boolean",
293
+ "kind": "boolean"
294
+ },
295
+ "required": false,
296
+ "default": "false",
297
+ "usageExample": "<Input showCount maxlength=\"50\" />"
298
+ },
299
+ {
300
+ "name": "showPassword",
301
+ "description": "当 type=\"password\" 时,是否展示显隐密码按钮",
302
+ "type": {
303
+ "raw": "boolean",
304
+ "kind": "boolean"
305
+ },
306
+ "required": false,
307
+ "default": "false",
308
+ "usageExample": "<Input type=\"password\" showPassword />"
309
+ }
310
+ ],
311
+ "slots": [
312
+ {
313
+ "name": "prepend",
314
+ "description": "输入框前置内容,展示在输入框外部左侧",
315
+ "vueTemplate": "#prepend",
316
+ "usageExample": "<Input v-model=\"url\">\n <template #prepend>http://</template>\n</Input>"
317
+ },
318
+ {
319
+ "name": "append",
320
+ "description": "输入框后置内容,展示在输入框外部右侧",
321
+ "vueTemplate": "#append",
322
+ "usageExample": "<Input v-model=\"email\">\n <template #append>.com</template>\n</Input>"
323
+ },
324
+ {
325
+ "name": "prefix",
326
+ "description": "输入框前缀图标或内容,展示在输入框内部左侧",
327
+ "vueTemplate": "#prefix",
328
+ "usageExample": "<Input v-model=\"user\">\n <template #prefix><Icon class=\"k-icon-user\" /></template>\n</Input>"
329
+ },
330
+ {
331
+ "name": "suffix",
332
+ "description": "输入框后缀图标或内容,展示在输入框内部右侧",
333
+ "vueTemplate": "#suffix",
334
+ "usageExample": "<Input v-model=\"search\">\n <template #suffix><Icon class=\"k-icon-search\" /></template>\n</Input>"
335
+ }
336
+ ],
337
+ "methods": [
338
+ {
339
+ "name": "focus",
340
+ "description": "使输入框获得焦点",
341
+ "params": [],
342
+ "returnType": "void",
343
+ "usageExample": "const inputRef = ref<InstanceType<typeof Input>>();\ninputRef.value?.focus();"
344
+ },
345
+ {
346
+ "name": "blur",
347
+ "description": "使输入框失去焦点",
348
+ "params": [],
349
+ "returnType": "void",
350
+ "usageExample": "inputRef.value?.blur();"
351
+ },
352
+ {
353
+ "name": "select",
354
+ "description": "全选输入框中的内容",
355
+ "params": [],
356
+ "returnType": "void",
357
+ "usageExample": "inputRef.value?.select();"
358
+ }
359
+ ],
360
+ "events": [
361
+ {
362
+ "name": "clear",
363
+ "vueEventName": "@clear",
364
+ "description": "点击清除按钮时触发",
365
+ "payload": [],
366
+ "usageExample": "<Input clearable @clear=\"handleClear\" />",
367
+ "handlerExample": "const handleClear = () => {\n console.log('内容已清空');\n};"
368
+ },
369
+ {
370
+ "name": "change",
371
+ "vueEventName": "@change",
372
+ "description": "原生 change 事件,绑定在组件内部 input 元素上",
373
+ "payload": [
374
+ {
375
+ "name": "event",
376
+ "type": "Event",
377
+ "description": "原生 change 事件对象"
378
+ }
379
+ ],
380
+ "usageExample": "<Input @change=\"handleChange\" />",
381
+ "handlerExample": "const handleChange = (e: Event) => {\n console.log('值已变化', (e.target as HTMLInputElement).value);\n};"
382
+ },
383
+ {
384
+ "name": "keydown",
385
+ "vueEventName": "@keydown",
386
+ "description": "原生 keydown 事件,绑定在组件内部 input 元素上",
387
+ "payload": [
388
+ {
389
+ "name": "event",
390
+ "type": "KeyboardEvent",
391
+ "description": "原生键盘事件对象"
392
+ }
393
+ ],
394
+ "usageExample": "<Input @keydown=\"handleKeydown\" />",
395
+ "handlerExample": "const handleKeydown = (e: KeyboardEvent) => {\n if (e.key === 'Enter') {\n console.log('按下回车');\n }\n};"
396
+ },
397
+ {
398
+ "name": "keyup",
399
+ "vueEventName": "@keyup",
400
+ "description": "原生 keyup 事件,绑定在组件内部 input 元素上",
401
+ "payload": [
402
+ {
403
+ "name": "event",
404
+ "type": "KeyboardEvent",
405
+ "description": "原生键盘事件对象"
406
+ }
407
+ ],
408
+ "usageExample": "<Input @keyup=\"handleKeyup\" />",
409
+ "handlerExample": "const handleKeyup = (e: KeyboardEvent) => {\n console.log('键盘抬起', e.key);\n};"
410
+ },
411
+ {
412
+ "name": "keypress",
413
+ "vueEventName": "@keypress",
414
+ "description": "原生 keypress 事件,绑定在组件内部 input 元素上",
415
+ "payload": [
416
+ {
417
+ "name": "event",
418
+ "type": "KeyboardEvent",
419
+ "description": "原生键盘事件对象"
420
+ }
421
+ ],
422
+ "usageExample": "<Input @keypress=\"handleKeypress\" />",
423
+ "handlerExample": "const handleKeypress = (e: KeyboardEvent) => {\n console.log('按键', e.key);\n};"
424
+ },
425
+ {
426
+ "name": "click",
427
+ "vueEventName": "@click",
428
+ "description": "原生 click 事件,绑定在组件最外层元素上",
429
+ "payload": [
430
+ {
431
+ "name": "event",
432
+ "type": "MouseEvent",
433
+ "description": "原生鼠标事件对象"
434
+ }
435
+ ],
436
+ "usageExample": "<Input @click=\"handleClick\" />",
437
+ "handlerExample": "const handleClick = (e: MouseEvent) => {\n console.log('点击输入框');\n};"
438
+ },
439
+ {
440
+ "name": "mouseenter",
441
+ "vueEventName": "@mouseenter",
442
+ "description": "原生 mouseenter 事件,绑定在组件最外层元素上",
443
+ "payload": [
444
+ {
445
+ "name": "event",
446
+ "type": "MouseEvent",
447
+ "description": "原生鼠标事件对象"
448
+ }
449
+ ],
450
+ "usageExample": "<Input @mouseenter=\"handleMouseenter\" />",
451
+ "handlerExample": "const handleMouseenter = (e: MouseEvent) => {\n console.log('鼠标进入');\n};"
452
+ },
453
+ {
454
+ "name": "mouseleave",
455
+ "vueEventName": "@mouseleave",
456
+ "description": "原生 mouseleave 事件,绑定在组件最外层元素上",
457
+ "payload": [
458
+ {
459
+ "name": "event",
460
+ "type": "MouseEvent",
461
+ "description": "原生鼠标事件对象"
462
+ }
463
+ ],
464
+ "usageExample": "<Input @mouseleave=\"handleMouseleave\" />",
465
+ "handlerExample": "const handleMouseleave = (e: MouseEvent) => {\n console.log('鼠标离开');\n};"
466
+ }
467
+ ],
468
+ "subComponents": [
469
+ {
470
+ "name": "Search",
471
+ "description": "搜索框组件,提供可展开收起的搜索输入框功能",
472
+ "props": [
473
+ {
474
+ "name": "value",
475
+ "description": "组件输入的值",
476
+ "type": {
477
+ "raw": "string",
478
+ "kind": "string"
479
+ },
480
+ "required": false,
481
+ "default": "\"\"",
482
+ "usageExample": "<Search v-model=\"keywords\" />"
483
+ },
484
+ {
485
+ "name": "placeholder",
486
+ "description": "占位文案",
487
+ "type": {
488
+ "raw": "string",
489
+ "kind": "string"
490
+ },
491
+ "required": false,
492
+ "default": "\"请输入关键字\"",
493
+ "usageExample": "<Search placeholder=\"搜索用户\" />"
494
+ },
495
+ {
496
+ "name": "type",
497
+ "description": "搜索框类型",
498
+ "type": {
499
+ "raw": "\"default\" | \"line\"",
500
+ "kind": "union",
501
+ "unionTypes": [
502
+ "default",
503
+ "line"
504
+ ]
505
+ },
506
+ "required": false,
507
+ "default": "\"default\"",
508
+ "allowedValues": [
509
+ {
510
+ "value": "default",
511
+ "label": "默认样式",
512
+ "isDefault": true
513
+ },
514
+ {
515
+ "value": "line",
516
+ "label": "线条样式"
517
+ }
518
+ ],
519
+ "usageExample": "<Search type=\"line\" />"
520
+ },
521
+ {
522
+ "name": "size",
523
+ "description": "尺寸",
524
+ "type": {
525
+ "raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
526
+ "kind": "union",
527
+ "unionTypes": [
528
+ "large",
529
+ "default",
530
+ "small",
531
+ "mini"
532
+ ]
533
+ },
534
+ "required": false,
535
+ "default": "\"default\"",
536
+ "allowedValues": [
537
+ {
538
+ "value": "large",
539
+ "label": "大尺寸"
540
+ },
541
+ {
542
+ "value": "default",
543
+ "label": "默认尺寸",
544
+ "isDefault": true
545
+ },
546
+ {
547
+ "value": "small",
548
+ "label": "小尺寸"
549
+ },
550
+ {
551
+ "value": "mini",
552
+ "label": "迷你尺寸"
553
+ }
554
+ ],
555
+ "usageExample": "<Search size=\"small\" />"
556
+ },
557
+ {
558
+ "name": "open",
559
+ "description": "是否展开状态",
560
+ "type": {
561
+ "raw": "boolean",
562
+ "kind": "boolean"
563
+ },
564
+ "required": false,
565
+ "default": "false",
566
+ "usageExample": "<Search :open=\"isExpanded\" />"
567
+ }
568
+ ],
569
+ "events": [
570
+ {
571
+ "name": "submit",
572
+ "vueEventName": "@submit",
573
+ "description": "表单提交事件,按回车或点击搜索按钮时触发",
574
+ "payload": [
575
+ {
576
+ "name": "keywords",
577
+ "type": "string",
578
+ "description": "当前搜索关键字"
579
+ }
580
+ ],
581
+ "usageExample": "<Search @submit=\"handleSearch\" />",
582
+ "handlerExample": "const handleSearch = (keywords: string) => {\n console.log('搜索关键字:', keywords);\n};"
583
+ }
584
+ ],
585
+ "methods": [
586
+ {
587
+ "name": "focus",
588
+ "description": "使搜索框获得焦点",
589
+ "params": [],
590
+ "returnType": "void",
591
+ "usageExample": "const searchRef = ref<InstanceType<typeof Search>>();\nsearchRef.value?.focus();"
592
+ },
593
+ {
594
+ "name": "blur",
595
+ "description": "使搜索框失去焦点",
596
+ "params": [],
597
+ "returnType": "void",
598
+ "usageExample": "searchRef.value?.blur();"
599
+ }
600
+ ]
601
+ }
602
+ ],
603
+ "examples": [
604
+ {
605
+ "id": "input_basic",
606
+ "title": "基础用法",
607
+ "description": "基本的输入框用法",
608
+ "difficulty": "easy",
609
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst value = ref('');\n</script>\n<template>\n <Input v-model=\"value\" placeholder=\"请输入内容\" />\n</template>",
610
+ "tags": [
611
+ "basic",
612
+ "v-model"
613
+ ],
614
+ "usedProps": [
615
+ "value",
616
+ "placeholder"
617
+ ],
618
+ "usedEvents": [],
619
+ "usedMethods": [],
620
+ "scenario": "创建一个基本的输入框,支持双向绑定"
621
+ },
622
+ {
623
+ "id": "input_clearable",
624
+ "title": "可清空输入框",
625
+ "description": "带有清除按钮的输入框",
626
+ "difficulty": "easy",
627
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst value = ref('默认文本');\n\nconst handleClear = () => {\n console.log('已清空');\n};\n</script>\n<template>\n <Input v-model=\"value\" clearable @clear=\"handleClear\" />\n</template>",
628
+ "tags": [
629
+ "clearable",
630
+ "clear"
631
+ ],
632
+ "usedProps": [
633
+ "value",
634
+ "clearable"
635
+ ],
636
+ "usedEvents": [
637
+ "clear"
638
+ ],
639
+ "usedMethods": [],
640
+ "scenario": "创建一个可以快速清空内容的输入框"
641
+ },
642
+ {
643
+ "id": "input_sizes",
644
+ "title": "不同尺寸",
645
+ "description": "展示不同尺寸的输入框",
646
+ "difficulty": "easy",
647
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst value = ref('');\n</script>\n<template>\n <Input v-model=\"value\" size=\"large\" placeholder=\"大尺寸\" />\n <Input v-model=\"value\" size=\"default\" placeholder=\"默认尺寸\" />\n <Input v-model=\"value\" size=\"small\" placeholder=\"小尺寸\" />\n <Input v-model=\"value\" size=\"mini\" placeholder=\"迷你尺寸\" />\n</template>",
648
+ "tags": [
649
+ "size",
650
+ "large",
651
+ "small",
652
+ "mini"
653
+ ],
654
+ "usedProps": [
655
+ "size",
656
+ "placeholder"
657
+ ],
658
+ "usedEvents": [],
659
+ "usedMethods": [],
660
+ "scenario": "展示输入框的各种尺寸"
661
+ },
662
+ {
663
+ "id": "input_textarea",
664
+ "title": "多行文本域",
665
+ "description": "使用 textarea 类型创建多行输入",
666
+ "difficulty": "easy",
667
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst content = ref('');\n</script>\n<template>\n <Input \n v-model=\"content\" \n type=\"textarea\" \n :rows=\"4\" \n placeholder=\"请输入详细内容\" \n />\n</template>",
668
+ "tags": [
669
+ "textarea",
670
+ "multiline",
671
+ "rows"
672
+ ],
673
+ "usedProps": [
674
+ "type",
675
+ "rows",
676
+ "placeholder"
677
+ ],
678
+ "usedEvents": [],
679
+ "usedMethods": [],
680
+ "scenario": "创建多行文本输入框,如备注、描述等场景"
681
+ },
682
+ {
683
+ "id": "input_password",
684
+ "title": "密码输入框",
685
+ "description": "使用 password 类型创建密码输入,配合 showPassword 属性可以展示显隐切换按钮。",
686
+ "difficulty": "easy",
687
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst password = ref('');\n</script>\n<template>\n <Input \n v-model=\"password\" \n type=\"password\" \n showPassword\n placeholder=\"请输入密码\" \n />\n</template>",
688
+ "tags": [
689
+ "password",
690
+ "security",
691
+ "showPassword"
692
+ ],
693
+ "usedProps": [
694
+ "type",
695
+ "placeholder",
696
+ "showPassword"
697
+ ],
698
+ "usedEvents": [],
699
+ "usedMethods": [],
700
+ "scenario": "用户输入密码并需要核对时使用"
701
+ },
702
+ {
703
+ "id": "input_showcount",
704
+ "title": "显示字数统计",
705
+ "description": "展示输入字符数量",
706
+ "difficulty": "easy",
707
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Input } from '@king-design/vue';\n\nconst value = ref('');\n</script>\n<template>\n <Input v-model=\"value\" showCount maxlength=\"50\" placeholder=\"最多50字\" />\n <Input v-model=\"value\" type=\"textarea\" showCount maxlength=\"200\" />\n</template>",
708
+ "tags": [
709
+ "showCount",
710
+ "maxlength",
711
+ "counter"
712
+ ],
713
+ "usedProps": [
714
+ "showCount"
715
+ ],
716
+ "usedEvents": [],
717
+ "usedMethods": [],
718
+ "scenario": "显示已输入字符数和最大限制"
719
+ },
720
+ {
721
+ "id": "input_search",
722
+ "title": "搜索框",
723
+ "description": "使用 Search 组件创建搜索输入框",
724
+ "difficulty": "medium",
725
+ "code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Search, Message } from '@king-design/vue';\n\nconst keywords = ref('');\n\nconst handleSubmit = (value: string) => {\n Message.info(`搜索: ${value}`);\n};\n</script>\n<template>\n <Search v-model=\"keywords\" @submit=\"handleSubmit\" />\n</template>",
726
+ "tags": [
727
+ "search",
728
+ "submit"
729
+ ],
730
+ "usedProps": [
731
+ "value"
732
+ ],
733
+ "usedEvents": [
734
+ "submit"
735
+ ],
736
+ "usedMethods": [],
737
+ "scenario": "创建搜索框,支持回车提交"
738
+ }
739
+ ],
740
+ "commonMistakes": [
741
+ {
742
+ "id": "input_textarea_rows",
743
+ "description": "设置 rows 但未指定 type=\"textarea\"",
744
+ "wrongCode": "<Input :rows=\"4\" placeholder=\"多行\" />",
745
+ "correctCode": "<Input type=\"textarea\" :rows=\"4\" placeholder=\"多行\" />",
746
+ "explanation": "rows 属性只在 type=\"textarea\" 时生效,普通 input 不支持 rows",
747
+ "relatedProps": [
748
+ "type",
749
+ "rows"
750
+ ]
751
+ },
752
+ {
753
+ "id": "input_size_typo",
754
+ "description": "使用不存在的 size 值 (Input)",
755
+ "wrongCode": "<Input size=\"medium\" />",
756
+ "correctCode": "<Input size=\"default\" />",
757
+ "explanation": "Input 的 size 只支持 large, default, small, mini。常见错误是使用 medium 值。",
758
+ "relatedProps": [
759
+ "size"
760
+ ]
761
+ },
762
+ {
763
+ "id": "input_resize_without_textarea",
764
+ "description": "在非 textarea 上使用 resize 属性",
765
+ "wrongCode": "<Input resize=\"both\" />",
766
+ "correctCode": "<Input type=\"textarea\" resize=\"both\" />",
767
+ "explanation": "resize 属性只对 type=\"textarea\" 生效",
768
+ "relatedProps": [
769
+ "type",
770
+ "resize"
771
+ ]
772
+ },
773
+ {
774
+ "id": "input_hallucinate_textarea",
775
+ "description": "错误地导入或使用不存在的 Textarea 组件",
776
+ "wrongCode": "import { Textarea } from '@king-design/vue';\n<Textarea v-model=\"desc\" />",
777
+ "correctCode": "import { Input } from '@king-design/vue';\n<Input type=\"textarea\" v-model=\"desc\" />",
778
+ "explanation": "KPC 组件库没有单独的 Textarea 组件,多行输入统一使用 Input 组件并设置 type=\"textarea\"。",
779
+ "relatedProps": [
780
+ "type"
781
+ ]
782
+ },
783
+ {
784
+ "id": "input_show_word_limit_hallucination",
785
+ "description": "使用 Element UI 的 show-word-limit 属性",
786
+ "wrongCode": "<Input show-word-limit />",
787
+ "correctCode": "<Input showCount />",
788
+ "explanation": "KPC 中展示字数计数的属性是 showCount,不是 show-word-limit。",
789
+ "relatedProps": [
790
+ "showCount"
791
+ ]
792
+ }
793
+ ],
794
+ "searchKeywords": [
795
+ "输入框",
796
+ "input",
797
+ "文本框",
798
+ "textarea",
799
+ "搜索",
800
+ "search",
801
+ "密码",
802
+ "password",
803
+ "表单",
804
+ "form",
805
+ "清空",
806
+ "clearable"
807
+ ],
808
+ "useCases": [
809
+ "表单中的文本输入",
810
+ "搜索关键字输入",
811
+ "密码输入",
812
+ "多行文本/备注输入",
813
+ "数字/金额输入",
814
+ "带前后缀的复合输入框"
815
+ ],
816
+ "relatedComponents": [
817
+ "Search",
818
+ "Form",
819
+ "FormItem"
820
+ ]
821
+ }