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,511 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "button",
|
|
3
|
+
"name": "Button",
|
|
4
|
+
"displayName": "按钮",
|
|
5
|
+
"category": "general",
|
|
6
|
+
"description": "用于触发操作,支持多种类型、尺寸和状态。可组合 ButtonGroup 实现按钮组、单选组、复选组等功能。",
|
|
7
|
+
"importStatement": "import { Button, ButtonGroup } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "type",
|
|
11
|
+
"description": "按钮类型,决定按钮的视觉样式",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "\"default\" | \"primary\" | \"warning\" | \"danger\" | \"success\" | \"secondary\" | \"link\" | \"flat\" | \"none\"",
|
|
14
|
+
"kind": "union",
|
|
15
|
+
"unionTypes": [
|
|
16
|
+
"default",
|
|
17
|
+
"primary",
|
|
18
|
+
"warning",
|
|
19
|
+
"danger",
|
|
20
|
+
"success",
|
|
21
|
+
"secondary",
|
|
22
|
+
"link",
|
|
23
|
+
"flat",
|
|
24
|
+
"none"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"required": false,
|
|
28
|
+
"default": "\"default\"",
|
|
29
|
+
"allowedValues": [
|
|
30
|
+
{
|
|
31
|
+
"value": "default",
|
|
32
|
+
"label": "默认按钮",
|
|
33
|
+
"isDefault": true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"value": "primary",
|
|
37
|
+
"label": "主要按钮(蓝色高亮)"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"value": "warning",
|
|
41
|
+
"label": "警告按钮(橙色)"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"value": "danger",
|
|
45
|
+
"label": "危险按钮(红色)"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"value": "success",
|
|
49
|
+
"label": "成功按钮(绿色)"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"value": "secondary",
|
|
53
|
+
"label": "次要按钮"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "link",
|
|
57
|
+
"label": "链接样式按钮"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"value": "flat",
|
|
61
|
+
"label": "扁平按钮"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"value": "none",
|
|
65
|
+
"label": "无样式按钮"
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"usageExample": "<Button type=\"primary\">主要按钮</Button>"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "size",
|
|
72
|
+
"description": "按钮尺寸",
|
|
73
|
+
"type": {
|
|
74
|
+
"raw": "\"default\" | \"small\" | \"mini\" | \"large\"",
|
|
75
|
+
"kind": "union",
|
|
76
|
+
"unionTypes": [
|
|
77
|
+
"default",
|
|
78
|
+
"small",
|
|
79
|
+
"mini",
|
|
80
|
+
"large"
|
|
81
|
+
]
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"default": "\"default\"",
|
|
85
|
+
"allowedValues": [
|
|
86
|
+
{
|
|
87
|
+
"value": "large",
|
|
88
|
+
"label": "大尺寸"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"value": "default",
|
|
92
|
+
"label": "默认尺寸",
|
|
93
|
+
"isDefault": true
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"value": "small",
|
|
97
|
+
"label": "小尺寸"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"value": "mini",
|
|
101
|
+
"label": "迷你尺寸"
|
|
102
|
+
}
|
|
103
|
+
],
|
|
104
|
+
"usageExample": "<Button size=\"small\">小按钮</Button>"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "icon",
|
|
108
|
+
"description": "是否为图标按钮(宽高相等)",
|
|
109
|
+
"type": {
|
|
110
|
+
"raw": "boolean",
|
|
111
|
+
"kind": "boolean"
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"default": "false",
|
|
115
|
+
"usageExample": "<Button icon><Icon class=\"k-icon-search\" /></Button>"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "circle",
|
|
119
|
+
"description": "是否为圆角按钮",
|
|
120
|
+
"type": {
|
|
121
|
+
"raw": "boolean",
|
|
122
|
+
"kind": "boolean"
|
|
123
|
+
},
|
|
124
|
+
"required": false,
|
|
125
|
+
"default": "false",
|
|
126
|
+
"usageExample": "<Button icon circle><Icon class=\"k-icon-plus\" /></Button>"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"name": "loading",
|
|
130
|
+
"description": "是否为正在加载中的按钮,加载时按钮会禁用点击",
|
|
131
|
+
"type": {
|
|
132
|
+
"raw": "boolean",
|
|
133
|
+
"kind": "boolean"
|
|
134
|
+
},
|
|
135
|
+
"required": false,
|
|
136
|
+
"default": "false",
|
|
137
|
+
"usageExample": "<Button type=\"primary\" :loading=\"isLoading\">提交中...</Button>"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
"name": "disabled",
|
|
141
|
+
"description": "是否禁用状态",
|
|
142
|
+
"type": {
|
|
143
|
+
"raw": "boolean",
|
|
144
|
+
"kind": "boolean"
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"default": "false",
|
|
148
|
+
"usageExample": "<Button disabled>禁用按钮</Button>"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "fluid",
|
|
152
|
+
"description": "是否宽度100%",
|
|
153
|
+
"type": {
|
|
154
|
+
"raw": "boolean",
|
|
155
|
+
"kind": "boolean"
|
|
156
|
+
},
|
|
157
|
+
"required": false,
|
|
158
|
+
"default": "false",
|
|
159
|
+
"usageExample": "<Button fluid>块级按钮</Button>"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "htmlType",
|
|
163
|
+
"description": "按钮<button>元素的type属性",
|
|
164
|
+
"type": {
|
|
165
|
+
"raw": "string",
|
|
166
|
+
"kind": "string"
|
|
167
|
+
},
|
|
168
|
+
"required": false,
|
|
169
|
+
"default": "\"button\"",
|
|
170
|
+
"allowedValues": [
|
|
171
|
+
{
|
|
172
|
+
"value": "button",
|
|
173
|
+
"label": "普通按钮",
|
|
174
|
+
"isDefault": true
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"value": "submit",
|
|
178
|
+
"label": "提交按钮"
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
"value": "reset",
|
|
182
|
+
"label": "重置按钮"
|
|
183
|
+
}
|
|
184
|
+
],
|
|
185
|
+
"usageExample": "<Button htmlType=\"submit\">提交表单</Button>"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"name": "tagName",
|
|
189
|
+
"description": "按钮渲染后的实际HTML元素,例如可以传入\"a\"来渲染成超链接",
|
|
190
|
+
"type": {
|
|
191
|
+
"raw": "string",
|
|
192
|
+
"kind": "string"
|
|
193
|
+
},
|
|
194
|
+
"required": false,
|
|
195
|
+
"default": "\"button\"",
|
|
196
|
+
"usageExample": "<Button tagName=\"a\" href=\"https://example.com\" target=\"_blank\">链接按钮</Button>"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "value",
|
|
200
|
+
"description": "对于radio/checkbox类型的按钮组,给按钮指定选中时的值",
|
|
201
|
+
"type": {
|
|
202
|
+
"raw": "*",
|
|
203
|
+
"kind": "custom"
|
|
204
|
+
},
|
|
205
|
+
"required": false,
|
|
206
|
+
"default": "undefined",
|
|
207
|
+
"usageExample": "<Button value=\"option1\">选项1</Button>"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"name": "ghost",
|
|
211
|
+
"description": "展示透明背景的按钮,适用于深色背景",
|
|
212
|
+
"type": {
|
|
213
|
+
"raw": "boolean",
|
|
214
|
+
"kind": "boolean"
|
|
215
|
+
},
|
|
216
|
+
"required": false,
|
|
217
|
+
"default": "false",
|
|
218
|
+
"usageExample": "<div style=\"background: #001529; padding: 16px;\">\n <Button ghost>幽灵按钮</Button>\n</div>"
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
"name": "class",
|
|
222
|
+
"description": "给按钮添加自定义类名,通常用于通过 CSS 类名来定义按钮的具体视觉样式",
|
|
223
|
+
"type": {
|
|
224
|
+
"raw": "string | Record<string, boolean>",
|
|
225
|
+
"kind": "union"
|
|
226
|
+
},
|
|
227
|
+
"required": false,
|
|
228
|
+
"default": "undefined",
|
|
229
|
+
"usageExample": "<Button class=\"my-custom-btn\">自定义类名按钮</Button>"
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
"events": [],
|
|
233
|
+
"slots": [
|
|
234
|
+
{
|
|
235
|
+
"name": "default",
|
|
236
|
+
"description": "按钮内容",
|
|
237
|
+
"vueTemplate": "#default",
|
|
238
|
+
"usageExample": "<Button>按钮文字</Button>"
|
|
239
|
+
}
|
|
240
|
+
],
|
|
241
|
+
"methods": [
|
|
242
|
+
{
|
|
243
|
+
"name": "showLoading",
|
|
244
|
+
"description": "展示 loading 状态",
|
|
245
|
+
"params": [],
|
|
246
|
+
"returnType": "void",
|
|
247
|
+
"usageExample": "const buttonRef = ref<InstanceType<typeof Button>>();\nbuttonRef.value?.showLoading();"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "hideLoading",
|
|
251
|
+
"description": "取消 loading 状态",
|
|
252
|
+
"params": [],
|
|
253
|
+
"returnType": "void",
|
|
254
|
+
"usageExample": "buttonRef.value?.hideLoading();"
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
"name": "disable",
|
|
258
|
+
"description": "禁用按钮",
|
|
259
|
+
"params": [],
|
|
260
|
+
"returnType": "void",
|
|
261
|
+
"usageExample": "buttonRef.value?.disable();"
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "enable",
|
|
265
|
+
"description": "启用按钮",
|
|
266
|
+
"params": [],
|
|
267
|
+
"returnType": "void",
|
|
268
|
+
"usageExample": "buttonRef.value?.enable();"
|
|
269
|
+
}
|
|
270
|
+
],
|
|
271
|
+
"subComponents": [
|
|
272
|
+
{
|
|
273
|
+
"name": "ButtonGroup",
|
|
274
|
+
"description": "按钮组容器,可实现按钮组合、单选组、复选组等功能",
|
|
275
|
+
"props": [
|
|
276
|
+
{
|
|
277
|
+
"name": "vertical",
|
|
278
|
+
"description": "是否垂直排列按钮组",
|
|
279
|
+
"type": {
|
|
280
|
+
"raw": "boolean",
|
|
281
|
+
"kind": "boolean"
|
|
282
|
+
},
|
|
283
|
+
"required": false,
|
|
284
|
+
"default": "false",
|
|
285
|
+
"usageExample": "<ButtonGroup vertical>\n <Button>上</Button>\n <Button>中</Button>\n <Button>下</Button>\n</ButtonGroup>"
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
"name": "checkType",
|
|
289
|
+
"description": "指定按钮组为单选或复选类型",
|
|
290
|
+
"type": {
|
|
291
|
+
"raw": "\"radio\" | \"checkbox\" | \"none\"",
|
|
292
|
+
"kind": "union",
|
|
293
|
+
"unionTypes": [
|
|
294
|
+
"radio",
|
|
295
|
+
"checkbox",
|
|
296
|
+
"none"
|
|
297
|
+
]
|
|
298
|
+
},
|
|
299
|
+
"required": false,
|
|
300
|
+
"default": "\"none\"",
|
|
301
|
+
"allowedValues": [
|
|
302
|
+
{
|
|
303
|
+
"value": "none",
|
|
304
|
+
"label": "普通按钮组",
|
|
305
|
+
"isDefault": true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"value": "radio",
|
|
309
|
+
"label": "单选按钮组"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"value": "checkbox",
|
|
313
|
+
"label": "复选按钮组"
|
|
314
|
+
}
|
|
315
|
+
],
|
|
316
|
+
"usageExample": "<ButtonGroup checkType=\"radio\" v-model=\"selected\">\n <Button value=\"a\">选项A</Button>\n <Button value=\"b\">选项B</Button>\n</ButtonGroup>"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"name": "value",
|
|
320
|
+
"description": "对于radio和checkbox类型按钮组,表示选中的按钮值,可用v-model双向绑定",
|
|
321
|
+
"type": {
|
|
322
|
+
"raw": "*",
|
|
323
|
+
"kind": "custom"
|
|
324
|
+
},
|
|
325
|
+
"required": false,
|
|
326
|
+
"default": "undefined",
|
|
327
|
+
"usageExample": "<ButtonGroup checkType=\"radio\" v-model=\"selectedValue\">"
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"name": "fluid",
|
|
331
|
+
"description": "是否宽度100%",
|
|
332
|
+
"type": {
|
|
333
|
+
"raw": "boolean",
|
|
334
|
+
"kind": "boolean"
|
|
335
|
+
},
|
|
336
|
+
"required": false,
|
|
337
|
+
"default": "false",
|
|
338
|
+
"usageExample": "<ButtonGroup fluid>"
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
"name": "separate",
|
|
342
|
+
"description": "是否展示间隔",
|
|
343
|
+
"type": {
|
|
344
|
+
"raw": "boolean",
|
|
345
|
+
"kind": "boolean"
|
|
346
|
+
},
|
|
347
|
+
"required": false,
|
|
348
|
+
"default": "false",
|
|
349
|
+
"usageExample": "<ButtonGroup separate>\n <Button>按钮1</Button>\n <Button>按钮2</Button>\n</ButtonGroup>"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "btnWidth",
|
|
353
|
+
"description": "指定按钮组每个按钮的固定宽度",
|
|
354
|
+
"type": {
|
|
355
|
+
"raw": "number | string",
|
|
356
|
+
"kind": "union"
|
|
357
|
+
},
|
|
358
|
+
"required": false,
|
|
359
|
+
"default": "undefined",
|
|
360
|
+
"usageExample": "<ButtonGroup btnWidth=\"100px\">"
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
],
|
|
365
|
+
"examples": [
|
|
366
|
+
{
|
|
367
|
+
"id": "button_types",
|
|
368
|
+
"title": "按钮类型",
|
|
369
|
+
"description": "展示不同类型的按钮",
|
|
370
|
+
"difficulty": "easy",
|
|
371
|
+
"code": "<script setup lang=\"ts\">\nimport { Button } from '@king-design/vue';\n</script>\n<template>\n <Button>默认按钮</Button>\n <Button type=\"primary\">主要按钮</Button>\n <Button type=\"warning\">警告按钮</Button>\n <Button type=\"danger\">危险按钮</Button>\n <Button type=\"success\">成功按钮</Button>\n</template>",
|
|
372
|
+
"tags": [
|
|
373
|
+
"type",
|
|
374
|
+
"basic"
|
|
375
|
+
],
|
|
376
|
+
"usedProps": [
|
|
377
|
+
"type"
|
|
378
|
+
],
|
|
379
|
+
"usedEvents": [],
|
|
380
|
+
"usedSlots": [
|
|
381
|
+
"default"
|
|
382
|
+
],
|
|
383
|
+
"usedMethods": [],
|
|
384
|
+
"scenario": "展示不同颜色类型的按钮,包括主要、警告、危险、成功等类型"
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"id": "button_loading",
|
|
388
|
+
"title": "加载状态按钮",
|
|
389
|
+
"description": "点击按钮后显示加载状态",
|
|
390
|
+
"difficulty": "medium",
|
|
391
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Button } from '@king-design/vue';\n\nconst loading = ref(false);\n\nconst handleClick = () => {\n loading.value = true;\n setTimeout(() => {\n loading.value = false;\n }, 2000);\n};\n</script>\n<template>\n <Button type=\"primary\" :loading=\"loading\" @click=\"handleClick\">\n {{ loading ? '提交中...' : '点击提交' }}\n </Button>\n</template>",
|
|
392
|
+
"tags": [
|
|
393
|
+
"loading",
|
|
394
|
+
"async",
|
|
395
|
+
"click"
|
|
396
|
+
],
|
|
397
|
+
"usedProps": [
|
|
398
|
+
"type",
|
|
399
|
+
"loading"
|
|
400
|
+
],
|
|
401
|
+
"usedEvents": [],
|
|
402
|
+
"usedSlots": [
|
|
403
|
+
"default"
|
|
404
|
+
],
|
|
405
|
+
"usedMethods": [],
|
|
406
|
+
"scenario": "创建一个点击后进入加载状态的按钮,模拟异步提交操作"
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
"id": "button_group_radio",
|
|
410
|
+
"title": "单选按钮组",
|
|
411
|
+
"description": "使用ButtonGroup实现单选功能",
|
|
412
|
+
"difficulty": "medium",
|
|
413
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Button, ButtonGroup } from '@king-design/vue';\n\nconst selected = ref('beijing');\n</script>\n<template>\n <ButtonGroup checkType=\"radio\" v-model=\"selected\">\n <Button value=\"beijing\">北京</Button>\n <Button value=\"shanghai\">上海</Button>\n <Button value=\"guangzhou\">广州</Button>\n </ButtonGroup>\n <p>当前选中: {{ selected }}</p>\n</template>",
|
|
414
|
+
"tags": [
|
|
415
|
+
"buttongroup",
|
|
416
|
+
"radio",
|
|
417
|
+
"v-model"
|
|
418
|
+
],
|
|
419
|
+
"usedProps": [
|
|
420
|
+
"checkType",
|
|
421
|
+
"value"
|
|
422
|
+
],
|
|
423
|
+
"usedEvents": [],
|
|
424
|
+
"usedSlots": [
|
|
425
|
+
"default"
|
|
426
|
+
],
|
|
427
|
+
"usedMethods": [],
|
|
428
|
+
"scenario": "创建一个城市选择的单选按钮组,支持双向绑定"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"id": "button_icon",
|
|
432
|
+
"title": "图标按钮",
|
|
433
|
+
"description": "创建带图标的按钮",
|
|
434
|
+
"difficulty": "easy",
|
|
435
|
+
"code": "<script setup lang=\"ts\">\nimport { Button, Icon } from '@king-design/vue';\n</script>\n<template>\n <Button icon><Icon class=\"k-icon-search\" /></Button>\n <Button icon circle type=\"primary\"><Icon class=\"k-icon-plus\" /></Button>\n <Button type=\"primary\"><Icon class=\"k-icon-search\" /> 搜索</Button>\n</template>",
|
|
436
|
+
"tags": [
|
|
437
|
+
"icon",
|
|
438
|
+
"circle"
|
|
439
|
+
],
|
|
440
|
+
"usedProps": [
|
|
441
|
+
"icon",
|
|
442
|
+
"circle",
|
|
443
|
+
"type"
|
|
444
|
+
],
|
|
445
|
+
"usedEvents": [],
|
|
446
|
+
"usedSlots": [
|
|
447
|
+
"default"
|
|
448
|
+
],
|
|
449
|
+
"usedMethods": [],
|
|
450
|
+
"scenario": "创建图标按钮,包括方形图标按钮、圆形图标按钮、带图标文字的按钮"
|
|
451
|
+
}
|
|
452
|
+
],
|
|
453
|
+
"commonMistakes": [
|
|
454
|
+
{
|
|
455
|
+
"id": "button_type_typo",
|
|
456
|
+
"description": "type 属性值拼写错误",
|
|
457
|
+
"wrongCode": "<Button type=\"primay\">",
|
|
458
|
+
"correctCode": "<Button type=\"primary\">",
|
|
459
|
+
"explanation": "type 必须使用预定义的值:default, primary, warning, danger, success, secondary, link, flat, none。常见错误是 primary 拼写为 primay",
|
|
460
|
+
"relatedProps": [
|
|
461
|
+
"type"
|
|
462
|
+
]
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
"id": "button_size_invalid",
|
|
466
|
+
"description": "使用不存在的 size 值 (Button)",
|
|
467
|
+
"wrongCode": "<Button size=\"medium\">",
|
|
468
|
+
"correctCode": "<Button size=\"default\">",
|
|
469
|
+
"explanation": "Button 的 size 只支持 large, default, small, mini。常见错误是使用 medium 值。",
|
|
470
|
+
"relatedProps": [
|
|
471
|
+
"size"
|
|
472
|
+
]
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"id": "buttongroup_no_value",
|
|
476
|
+
"description": "单选/复选按钮组未给 Button 设置 value",
|
|
477
|
+
"wrongCode": "<ButtonGroup checkType=\"radio\" v-model=\"selected\">\n <Button>选项A</Button>\n <Button>选项B</Button>\n</ButtonGroup>",
|
|
478
|
+
"correctCode": "<ButtonGroup checkType=\"radio\" v-model=\"selected\">\n <Button value=\"a\">选项A</Button>\n <Button value=\"b\">选项B</Button>\n</ButtonGroup>",
|
|
479
|
+
"explanation": "使用 checkType=\"radio\" 或 checkType=\"checkbox\" 时,每个 Button 必须设置 value 属性,否则无法正确绑定选中值",
|
|
480
|
+
"relatedProps": [
|
|
481
|
+
"checkType",
|
|
482
|
+
"value"
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
],
|
|
486
|
+
"searchKeywords": [
|
|
487
|
+
"按钮",
|
|
488
|
+
"button",
|
|
489
|
+
"提交",
|
|
490
|
+
"点击",
|
|
491
|
+
"操作",
|
|
492
|
+
"ButtonGroup",
|
|
493
|
+
"按钮组",
|
|
494
|
+
"单选",
|
|
495
|
+
"复选",
|
|
496
|
+
"loading",
|
|
497
|
+
"加载"
|
|
498
|
+
],
|
|
499
|
+
"useCases": [
|
|
500
|
+
"表单提交按钮",
|
|
501
|
+
"操作确认按钮",
|
|
502
|
+
"导航链接按钮",
|
|
503
|
+
"带 loading 的异步操作按钮",
|
|
504
|
+
"城市切换单选按钮组",
|
|
505
|
+
"多选标签按钮组"
|
|
506
|
+
],
|
|
507
|
+
"relatedComponents": [
|
|
508
|
+
"ButtonGroup",
|
|
509
|
+
"Icon"
|
|
510
|
+
]
|
|
511
|
+
}
|