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,1057 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "table",
|
|
3
|
+
"name": "Table",
|
|
4
|
+
"displayName": "表格",
|
|
5
|
+
"category": "data",
|
|
6
|
+
"description": "用于展示结构化数据,支持选择、排序、筛选、分页、固定列、树形数据、虚拟滚动等功能",
|
|
7
|
+
"importStatement": "import { Table, TableColumn } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "data",
|
|
11
|
+
"description": "表格数据数组",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "T[]",
|
|
14
|
+
"kind": "array"
|
|
15
|
+
},
|
|
16
|
+
"required": false,
|
|
17
|
+
"default": "undefined",
|
|
18
|
+
"usageExample": "<Table :data=\"tableData\">"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "fixHeader",
|
|
22
|
+
"description": "表头固定,给定需要固定高度的具体数值,当超出该值时,展示滚动条",
|
|
23
|
+
"type": {
|
|
24
|
+
"raw": "boolean | number | string",
|
|
25
|
+
"kind": "union"
|
|
26
|
+
},
|
|
27
|
+
"required": false,
|
|
28
|
+
"default": "false",
|
|
29
|
+
"usageExample": "<Table :data=\"data\" :fixHeader=\"300\">"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "stickHeader",
|
|
33
|
+
"description": "表头吸顶,给定需要吸顶的高度,当表头在页面滚动滚动时,距离视窗顶部的距离等于该高度时,将表头固定在此高度处",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "boolean | number | string",
|
|
36
|
+
"kind": "union"
|
|
37
|
+
},
|
|
38
|
+
"required": false,
|
|
39
|
+
"default": "false"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "stickScrollbar",
|
|
43
|
+
"description": "当出现横向滚动条时,设置是否当表格底部没有滚动到视窗中时,将横向滚动条固定在页面底部;取值为number类型时,用来指定距离视窗底部的距离",
|
|
44
|
+
"type": {
|
|
45
|
+
"raw": "boolean | number | string",
|
|
46
|
+
"kind": "union"
|
|
47
|
+
},
|
|
48
|
+
"required": false,
|
|
49
|
+
"default": "false"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "checkType",
|
|
53
|
+
"description": "当行可选择时,定义选择的类型: 单选 \"radio\" , 复选 \"checkbox\", 不可选 \"none\"",
|
|
54
|
+
"type": {
|
|
55
|
+
"raw": "\"checkbox\" | \"radio\" | \"none\"",
|
|
56
|
+
"kind": "union"
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"default": "\"checkbox\"",
|
|
60
|
+
"allowedValues": [
|
|
61
|
+
{
|
|
62
|
+
"value": "checkbox",
|
|
63
|
+
"label": "复选",
|
|
64
|
+
"isDefault": true
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"value": "radio",
|
|
68
|
+
"label": "单选"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"value": "none",
|
|
72
|
+
"label": "不可选"
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "checkedKeys",
|
|
78
|
+
"description": "通过key数组来指定哪些行被选中,可用v-model:checkedKeys双向绑定",
|
|
79
|
+
"type": {
|
|
80
|
+
"raw": "TableRowKey[]",
|
|
81
|
+
"kind": "array"
|
|
82
|
+
},
|
|
83
|
+
"required": false,
|
|
84
|
+
"default": "[]"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"name": "rowKey",
|
|
88
|
+
"description": "设置每行的key",
|
|
89
|
+
"type": {
|
|
90
|
+
"raw": "(value: T, index: number) => TableRowKey",
|
|
91
|
+
"kind": "function"
|
|
92
|
+
},
|
|
93
|
+
"required": false,
|
|
94
|
+
"default": "(value, index) => index"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "rowCheckable",
|
|
98
|
+
"description": "当行可选时,是否点击该行任意区域都可选中",
|
|
99
|
+
"type": {
|
|
100
|
+
"raw": "boolean",
|
|
101
|
+
"kind": "boolean"
|
|
102
|
+
},
|
|
103
|
+
"required": false,
|
|
104
|
+
"default": "true"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"name": "disableRow",
|
|
108
|
+
"description": "定义行禁用可选的逻辑,返回true,则该行被禁用选择",
|
|
109
|
+
"type": {
|
|
110
|
+
"raw": "(value: T, index: number, key: TableRowKey) => boolean",
|
|
111
|
+
"kind": "function"
|
|
112
|
+
},
|
|
113
|
+
"required": false,
|
|
114
|
+
"default": "undefined"
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"name": "type",
|
|
118
|
+
"description": "表格类型,默认左右无边框,\"border\"类型会添加边框, \"grid\"类型会展示栅格边框",
|
|
119
|
+
"type": {
|
|
120
|
+
"raw": "\"default\" | \"border\" | \"grid\"",
|
|
121
|
+
"kind": "union"
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"default": "\"default\"",
|
|
125
|
+
"allowedValues": [
|
|
126
|
+
{
|
|
127
|
+
"value": "default",
|
|
128
|
+
"label": "默认",
|
|
129
|
+
"isDefault": true
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"value": "border",
|
|
133
|
+
"label": "带边框"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"value": "grid",
|
|
137
|
+
"label": "栅格边框"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"name": "stripe",
|
|
143
|
+
"description": "相邻行是否展示不同的背景色",
|
|
144
|
+
"type": {
|
|
145
|
+
"raw": "boolean",
|
|
146
|
+
"kind": "boolean"
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"default": "false"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "rowClassName",
|
|
153
|
+
"description": "通过一个函数定义行的className,该函数会传入该行数据,索引和key当做参数,返回的字符串将被设为该行的className",
|
|
154
|
+
"type": {
|
|
155
|
+
"raw": "(value: T, index: number, key: TableRowKey) => string | undefined",
|
|
156
|
+
"kind": "function"
|
|
157
|
+
},
|
|
158
|
+
"required": false,
|
|
159
|
+
"default": "undefined"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "group",
|
|
163
|
+
"description": "分组配置",
|
|
164
|
+
"type": {
|
|
165
|
+
"raw": "TableGroupValue",
|
|
166
|
+
"kind": "object"
|
|
167
|
+
},
|
|
168
|
+
"required": false,
|
|
169
|
+
"default": "undefined"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "sort",
|
|
173
|
+
"description": "排序配置,可用v-model:sort双向绑定",
|
|
174
|
+
"type": {
|
|
175
|
+
"raw": "TableSortValue",
|
|
176
|
+
"kind": "object"
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"default": "undefined"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "loading",
|
|
183
|
+
"description": "是否展示加载状态",
|
|
184
|
+
"type": {
|
|
185
|
+
"raw": "boolean",
|
|
186
|
+
"kind": "boolean"
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"default": "false"
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "merge",
|
|
193
|
+
"description": "指定表格单元格合并逻辑",
|
|
194
|
+
"type": {
|
|
195
|
+
"raw": "TableMerge",
|
|
196
|
+
"kind": "function"
|
|
197
|
+
},
|
|
198
|
+
"required": false,
|
|
199
|
+
"default": "undefined"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "expandedKeys",
|
|
203
|
+
"description": "通过key来指定哪些行展开,可用v-model:expandedKeys绑定",
|
|
204
|
+
"type": {
|
|
205
|
+
"raw": "TableRowKey[]",
|
|
206
|
+
"kind": "array"
|
|
207
|
+
},
|
|
208
|
+
"required": false,
|
|
209
|
+
"default": "undefined"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "rowExpandable",
|
|
213
|
+
"description": "是否点击该行任意区域即展开",
|
|
214
|
+
"type": {
|
|
215
|
+
"raw": "boolean",
|
|
216
|
+
"kind": "boolean"
|
|
217
|
+
},
|
|
218
|
+
"required": false,
|
|
219
|
+
"default": "true"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "selectedKeys",
|
|
223
|
+
"description": "当rowSelectable取值为非false时,指定哪些行高亮",
|
|
224
|
+
"type": {
|
|
225
|
+
"raw": "TableRowKey[]",
|
|
226
|
+
"kind": "array"
|
|
227
|
+
},
|
|
228
|
+
"required": false,
|
|
229
|
+
"default": "undefined"
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "rowSelectable",
|
|
233
|
+
"description": "是否点击行时高亮该行,取值为multiple时,可以同时高亮多行",
|
|
234
|
+
"type": {
|
|
235
|
+
"raw": "boolean | \"single\" | \"multiple\"",
|
|
236
|
+
"kind": "union"
|
|
237
|
+
},
|
|
238
|
+
"required": false,
|
|
239
|
+
"default": "false"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "childrenKey",
|
|
243
|
+
"description": "树形表格指定子元素键名",
|
|
244
|
+
"type": {
|
|
245
|
+
"raw": "string",
|
|
246
|
+
"kind": "string"
|
|
247
|
+
},
|
|
248
|
+
"required": false,
|
|
249
|
+
"default": "\"children\""
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"name": "indent",
|
|
253
|
+
"description": "树形表格指定子元素缩进宽度",
|
|
254
|
+
"type": {
|
|
255
|
+
"raw": "number",
|
|
256
|
+
"kind": "number"
|
|
257
|
+
},
|
|
258
|
+
"required": false,
|
|
259
|
+
"default": "32"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "spreadKeys",
|
|
263
|
+
"description": "树形表格指定展开的行,可用v-model:spreadKeys绑定",
|
|
264
|
+
"type": {
|
|
265
|
+
"raw": "TableRowKey[]",
|
|
266
|
+
"kind": "array"
|
|
267
|
+
},
|
|
268
|
+
"required": false,
|
|
269
|
+
"default": "undefined"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"name": "tooltipPosition",
|
|
273
|
+
"description": "行提示的位置",
|
|
274
|
+
"type": {
|
|
275
|
+
"raw": "\"left\" | \"bottom\" | \"right\" | \"top\" | Position",
|
|
276
|
+
"kind": "union"
|
|
277
|
+
},
|
|
278
|
+
"required": false,
|
|
279
|
+
"default": "\"top\""
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"name": "tooltipContainer",
|
|
283
|
+
"description": "指定行提示弹层追加的位置,支持函数或 CSS 选择器",
|
|
284
|
+
"type": {
|
|
285
|
+
"raw": "Container",
|
|
286
|
+
"kind": "custom"
|
|
287
|
+
},
|
|
288
|
+
"required": false,
|
|
289
|
+
"default": "undefined"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"name": "keepStatus",
|
|
293
|
+
"description": "是否在行销毁的时候,保持该行在checkedKeys | selectedKeys | spreadKeys | expandedKeys中的key值",
|
|
294
|
+
"type": {
|
|
295
|
+
"raw": "boolean",
|
|
296
|
+
"kind": "boolean"
|
|
297
|
+
},
|
|
298
|
+
"required": false,
|
|
299
|
+
"default": "false"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "showIndeterminate",
|
|
303
|
+
"description": "表头的Checkbox是否支持展示半选中状态",
|
|
304
|
+
"type": {
|
|
305
|
+
"raw": "boolean",
|
|
306
|
+
"kind": "boolean"
|
|
307
|
+
},
|
|
308
|
+
"required": false,
|
|
309
|
+
"default": "true"
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"name": "resizable",
|
|
313
|
+
"description": "是否可以表头拖动调整列宽",
|
|
314
|
+
"type": {
|
|
315
|
+
"raw": "boolean",
|
|
316
|
+
"kind": "boolean"
|
|
317
|
+
},
|
|
318
|
+
"required": false,
|
|
319
|
+
"default": "false"
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
"name": "minColWidth",
|
|
323
|
+
"description": "指定所有列拖动时的最小宽度",
|
|
324
|
+
"type": {
|
|
325
|
+
"raw": "number",
|
|
326
|
+
"kind": "number"
|
|
327
|
+
},
|
|
328
|
+
"required": false,
|
|
329
|
+
"default": "40"
|
|
330
|
+
},
|
|
331
|
+
{
|
|
332
|
+
"name": "widthStoreKey",
|
|
333
|
+
"description": "如果要保存表格拖动后的列宽信息,可以通过该属性设置保存到localStorage中的key",
|
|
334
|
+
"type": {
|
|
335
|
+
"raw": "string",
|
|
336
|
+
"kind": "string"
|
|
337
|
+
},
|
|
338
|
+
"required": false,
|
|
339
|
+
"default": "undefined"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"name": "draggable",
|
|
343
|
+
"description": "表格行是否可拖动排序",
|
|
344
|
+
"type": {
|
|
345
|
+
"raw": "boolean",
|
|
346
|
+
"kind": "boolean"
|
|
347
|
+
},
|
|
348
|
+
"required": false,
|
|
349
|
+
"default": "false"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"name": "animation",
|
|
353
|
+
"description": "是否开启动效,可以通过数组单独设置行和列的动效",
|
|
354
|
+
"type": {
|
|
355
|
+
"raw": "boolean | [boolean, boolean]",
|
|
356
|
+
"kind": "union"
|
|
357
|
+
},
|
|
358
|
+
"required": false,
|
|
359
|
+
"default": "true"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
"name": "hideHeader",
|
|
363
|
+
"description": "是否隐藏表头",
|
|
364
|
+
"type": {
|
|
365
|
+
"raw": "boolean",
|
|
366
|
+
"kind": "boolean"
|
|
367
|
+
},
|
|
368
|
+
"required": false,
|
|
369
|
+
"default": "false"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"name": "pagination",
|
|
373
|
+
"description": "是否支持分页,可传入对象配置分页参数",
|
|
374
|
+
"type": {
|
|
375
|
+
"raw": "boolean | PaginationProps",
|
|
376
|
+
"kind": "union"
|
|
377
|
+
},
|
|
378
|
+
"required": false,
|
|
379
|
+
"default": "false"
|
|
380
|
+
},
|
|
381
|
+
{
|
|
382
|
+
"name": "fixFooter",
|
|
383
|
+
"description": "table给定需要固定高度时,自定义footer固定",
|
|
384
|
+
"type": {
|
|
385
|
+
"raw": "boolean",
|
|
386
|
+
"kind": "boolean"
|
|
387
|
+
},
|
|
388
|
+
"required": false,
|
|
389
|
+
"default": "false"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
"name": "load",
|
|
393
|
+
"description": "指定异步加载节点数据的函数,该函数通过Promise返回数组来添加子节点数据",
|
|
394
|
+
"type": {
|
|
395
|
+
"raw": "(node: any) => Promise<any[]> | void",
|
|
396
|
+
"kind": "function"
|
|
397
|
+
},
|
|
398
|
+
"required": false,
|
|
399
|
+
"default": "undefined"
|
|
400
|
+
},
|
|
401
|
+
{
|
|
402
|
+
"name": "spreadArrowIndex",
|
|
403
|
+
"description": "指定树形表格展开Icon的所在列,默认在第一列",
|
|
404
|
+
"type": {
|
|
405
|
+
"raw": "number",
|
|
406
|
+
"kind": "number"
|
|
407
|
+
},
|
|
408
|
+
"required": false,
|
|
409
|
+
"default": "0"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
"name": "virtual",
|
|
413
|
+
"description": "是否开启虚拟滚动,适用于大数据量场景",
|
|
414
|
+
"type": {
|
|
415
|
+
"raw": "boolean",
|
|
416
|
+
"kind": "boolean"
|
|
417
|
+
},
|
|
418
|
+
"required": false,
|
|
419
|
+
"default": "false"
|
|
420
|
+
}
|
|
421
|
+
],
|
|
422
|
+
"events": [
|
|
423
|
+
{
|
|
424
|
+
"name": "clickRow",
|
|
425
|
+
"vueEventName": "@click-row",
|
|
426
|
+
"description": "点击某行时触发",
|
|
427
|
+
"payload": [
|
|
428
|
+
{
|
|
429
|
+
"name": "data",
|
|
430
|
+
"type": "T",
|
|
431
|
+
"description": "行数据"
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"name": "index",
|
|
435
|
+
"type": "number",
|
|
436
|
+
"description": "行索引"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"name": "key",
|
|
440
|
+
"type": "TableRowKey",
|
|
441
|
+
"description": "行key"
|
|
442
|
+
}
|
|
443
|
+
],
|
|
444
|
+
"usageExample": "<Table :data=\"data\" @click-row=\"handleClickRow\">",
|
|
445
|
+
"handlerExample": "const handleClickRow = (data: any, index: number, key: string | number) => {\n console.log('点击行:', data);\n};"
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"name": "dragstart",
|
|
449
|
+
"vueEventName": "@dragstart",
|
|
450
|
+
"description": "行拖动开始",
|
|
451
|
+
"payload": [
|
|
452
|
+
{
|
|
453
|
+
"name": "data",
|
|
454
|
+
"type": "{key: TableRowKey, from: number}",
|
|
455
|
+
"description": "拖动开始信息"
|
|
456
|
+
}
|
|
457
|
+
],
|
|
458
|
+
"usageExample": "<Table :data=\"data\" draggable @dragstart=\"handleDragStart\">"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"name": "dragend",
|
|
462
|
+
"vueEventName": "@dragend",
|
|
463
|
+
"description": "行拖动结束时触发",
|
|
464
|
+
"payload": [
|
|
465
|
+
{
|
|
466
|
+
"name": "data",
|
|
467
|
+
"type": "{key: TableRowKey, from: number, to: number}",
|
|
468
|
+
"description": "拖动结束信息"
|
|
469
|
+
}
|
|
470
|
+
],
|
|
471
|
+
"usageExample": "<Table :data=\"data\" draggable @dragend=\"handleDragEnd\">",
|
|
472
|
+
"handlerExample": "const handleDragEnd = (info: {key: number, from: number, to: number}) => {\n const item = data.value.splice(info.from, 1)[0];\n data.value.splice(info.to, 0, item);\n};"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"name": "checkRow",
|
|
476
|
+
"vueEventName": "@check-row",
|
|
477
|
+
"description": "手动选中某行时触发",
|
|
478
|
+
"payload": [
|
|
479
|
+
{
|
|
480
|
+
"name": "data",
|
|
481
|
+
"type": "T",
|
|
482
|
+
"description": "选中行数据"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"name": "index",
|
|
486
|
+
"type": "number",
|
|
487
|
+
"description": "行索引"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"name": "key",
|
|
491
|
+
"type": "TableRowKey",
|
|
492
|
+
"description": "行key"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"usageExample": "<Table :data=\"data\" @check-row=\"handleCheckRow\">",
|
|
496
|
+
"handlerExample": "const handleCheckRow = (data: any, index: number, key: string | number) => {\n console.log('选中行:', data);\n};"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"name": "uncheckRow",
|
|
500
|
+
"vueEventName": "@uncheck-row",
|
|
501
|
+
"description": "手动取消选中某行时触发",
|
|
502
|
+
"payload": [
|
|
503
|
+
{
|
|
504
|
+
"name": "data",
|
|
505
|
+
"type": "T",
|
|
506
|
+
"description": "取消选中行数据"
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"name": "index",
|
|
510
|
+
"type": "number",
|
|
511
|
+
"description": "行索引"
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
"name": "key",
|
|
515
|
+
"type": "TableRowKey",
|
|
516
|
+
"description": "行key"
|
|
517
|
+
}
|
|
518
|
+
],
|
|
519
|
+
"usageExample": "<Table :data=\"data\" @uncheck-row=\"handleUncheckRow\">",
|
|
520
|
+
"handlerExample": "const handleUncheckRow = (data: any, index: number, key: string | number) => {\n console.log('取消选中:', data);\n};"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
"name": "checkAll",
|
|
524
|
+
"vueEventName": "@check-all",
|
|
525
|
+
"description": "手动全选触发",
|
|
526
|
+
"payload": [],
|
|
527
|
+
"usageExample": "<Table @check-all=\"handleCheckAll\" />"
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"name": "uncheckAll",
|
|
531
|
+
"vueEventName": "@uncheck-all",
|
|
532
|
+
"description": "手动取消全选触发",
|
|
533
|
+
"payload": [],
|
|
534
|
+
"usageExample": "<Table @uncheck-all=\"handleUncheckAll\" />"
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
"name": "page",
|
|
538
|
+
"vueEventName": "@page",
|
|
539
|
+
"description": "当内置翻页改变页码或每页数量时触发",
|
|
540
|
+
"payload": [
|
|
541
|
+
{
|
|
542
|
+
"name": "data",
|
|
543
|
+
"type": "{value: number, limit: number}",
|
|
544
|
+
"description": "分页信息"
|
|
545
|
+
}
|
|
546
|
+
],
|
|
547
|
+
"usageExample": "<Table :data=\"data\" :pagination=\"true\" @page=\"handlePage\">",
|
|
548
|
+
"handlerExample": "const handlePage = (pageInfo: {value: number, limit: number}) => {\n console.log('当前页:', pageInfo.value, '每页:', pageInfo.limit);\n};"
|
|
549
|
+
}
|
|
550
|
+
],
|
|
551
|
+
"slots": [
|
|
552
|
+
{
|
|
553
|
+
"name": "empty",
|
|
554
|
+
"description": "自定义无数据展示模板",
|
|
555
|
+
"vueTemplate": "#empty",
|
|
556
|
+
"usageExample": "<Table :data=\"[]\">\n <template #empty>\n <div>暂无数据</div>\n </template>\n</Table>"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"name": "expand",
|
|
560
|
+
"description": "指定行展开后要展示的模板内容",
|
|
561
|
+
"slotProps": [
|
|
562
|
+
{
|
|
563
|
+
"name": "row",
|
|
564
|
+
"type": "T",
|
|
565
|
+
"description": "当前行数据",
|
|
566
|
+
"destructuringExample": "[row]"
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
"name": "index",
|
|
570
|
+
"type": "number",
|
|
571
|
+
"description": "行索引"
|
|
572
|
+
}
|
|
573
|
+
],
|
|
574
|
+
"vueTemplate": "#expand=\"[row, index]\"",
|
|
575
|
+
"usageExample": "<Table :data=\"data\">\n <template #expand=\"[row]\">\n <div>{{ row.detail }}</div>\n </template>\n</Table>"
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
"name": "footer",
|
|
579
|
+
"description": "自定义表格底部",
|
|
580
|
+
"vueTemplate": "#footer",
|
|
581
|
+
"usageExample": "<Table :data=\"data\">\n <template #footer>\n <div>总计: {{ total }}</div>\n </template>\n</Table>"
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
"name": "tooltip",
|
|
585
|
+
"description": "行提示内容",
|
|
586
|
+
"slotProps": [
|
|
587
|
+
{
|
|
588
|
+
"name": "data",
|
|
589
|
+
"type": "T",
|
|
590
|
+
"description": "当前行数据",
|
|
591
|
+
"destructuringExample": "[data]"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
"name": "index",
|
|
595
|
+
"type": "number",
|
|
596
|
+
"description": "行索引"
|
|
597
|
+
}
|
|
598
|
+
],
|
|
599
|
+
"vueTemplate": "#tooltip=\"[data, index]\"",
|
|
600
|
+
"usageExample": "<Table :data=\"data\">\n <template #tooltip=\"[data]\">\n <div>提示: {{ data.tip }}</div>\n </template>\n</Table>"
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
"methods": [
|
|
604
|
+
{
|
|
605
|
+
"name": "getCheckedData",
|
|
606
|
+
"description": "获取选中数据信息",
|
|
607
|
+
"params": [],
|
|
608
|
+
"returnType": "T[]",
|
|
609
|
+
"usageExample": "const tableRef = ref<InstanceType<typeof Table>>();\nconst checkedData = tableRef.value?.getCheckedData();"
|
|
610
|
+
},
|
|
611
|
+
{
|
|
612
|
+
"name": "getSelectedData",
|
|
613
|
+
"description": "获取高亮行数据信息",
|
|
614
|
+
"params": [],
|
|
615
|
+
"returnType": "T[]",
|
|
616
|
+
"usageExample": "const selectedData = tableRef.value?.getSelectedData();"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"name": "checkAll",
|
|
620
|
+
"description": "全部选中",
|
|
621
|
+
"params": [],
|
|
622
|
+
"returnType": "void",
|
|
623
|
+
"usageExample": "tableRef.value?.checkAll();"
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
"name": "uncheckAll",
|
|
627
|
+
"description": "全不选中",
|
|
628
|
+
"params": [],
|
|
629
|
+
"returnType": "void",
|
|
630
|
+
"usageExample": "tableRef.value?.uncheckAll();"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "scrollToRowByIndex",
|
|
634
|
+
"description": "通过索引指定滚动的行",
|
|
635
|
+
"params": [
|
|
636
|
+
{
|
|
637
|
+
"name": "index",
|
|
638
|
+
"type": "number",
|
|
639
|
+
"description": "行索引"
|
|
640
|
+
}
|
|
641
|
+
],
|
|
642
|
+
"returnType": "Promise<void>",
|
|
643
|
+
"usageExample": "await tableRef.value?.scrollToRowByIndex(10);"
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
"name": "scrollToRowByKey",
|
|
647
|
+
"description": "通过key指定滚动的行",
|
|
648
|
+
"params": [
|
|
649
|
+
{
|
|
650
|
+
"name": "key",
|
|
651
|
+
"type": "TableRowKey",
|
|
652
|
+
"description": "行key"
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
"returnType": "Promise<void>",
|
|
656
|
+
"usageExample": "await tableRef.value?.scrollToRowByKey('row-id-123');"
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
"name": "exportTable",
|
|
660
|
+
"description": "导出表格",
|
|
661
|
+
"params": [
|
|
662
|
+
{
|
|
663
|
+
"name": "data",
|
|
664
|
+
"type": "T[]",
|
|
665
|
+
"description": "要导出的数据",
|
|
666
|
+
"optional": true,
|
|
667
|
+
"default": "this.data"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
"name": "filename",
|
|
671
|
+
"type": "string",
|
|
672
|
+
"description": "导出文件名",
|
|
673
|
+
"optional": true,
|
|
674
|
+
"default": "\"table\""
|
|
675
|
+
}
|
|
676
|
+
],
|
|
677
|
+
"returnType": "Promise<string>",
|
|
678
|
+
"usageExample": "const content = await tableRef.value?.exportTable(data.value, 'users');"
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
"subComponents": [
|
|
682
|
+
{
|
|
683
|
+
"name": "TableColumn",
|
|
684
|
+
"description": "表格列定义",
|
|
685
|
+
"props": [
|
|
686
|
+
{
|
|
687
|
+
"name": "key",
|
|
688
|
+
"description": "指定当前列的key,必须指定",
|
|
689
|
+
"type": {
|
|
690
|
+
"raw": "string",
|
|
691
|
+
"kind": "string"
|
|
692
|
+
},
|
|
693
|
+
"required": true,
|
|
694
|
+
"usageExample": "<TableColumn key=\"name\" title=\"姓名\" />"
|
|
695
|
+
},
|
|
696
|
+
{
|
|
697
|
+
"name": "title",
|
|
698
|
+
"description": "列标题",
|
|
699
|
+
"type": {
|
|
700
|
+
"raw": "string | VNode",
|
|
701
|
+
"kind": "union"
|
|
702
|
+
},
|
|
703
|
+
"required": false,
|
|
704
|
+
"usageExample": "<TableColumn key=\"name\" title=\"姓名\" />"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"name": "sortable",
|
|
708
|
+
"description": "是否可排序",
|
|
709
|
+
"type": {
|
|
710
|
+
"raw": "boolean",
|
|
711
|
+
"kind": "boolean"
|
|
712
|
+
},
|
|
713
|
+
"required": false,
|
|
714
|
+
"default": "false",
|
|
715
|
+
"usageExample": "<TableColumn key=\"age\" title=\"年龄\" sortable />"
|
|
716
|
+
},
|
|
717
|
+
{
|
|
718
|
+
"name": "width",
|
|
719
|
+
"description": "列宽,可以指定百分比或像素(像素不需要加单位)",
|
|
720
|
+
"type": {
|
|
721
|
+
"raw": "string",
|
|
722
|
+
"kind": "string"
|
|
723
|
+
},
|
|
724
|
+
"required": false,
|
|
725
|
+
"usageExample": "<TableColumn key=\"name\" title=\"姓名\" width=\"200\" />"
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
"name": "group",
|
|
729
|
+
"description": "指定分组数组,每一项格式为{value: '选中后的值', label: '展示的文案'}",
|
|
730
|
+
"type": {
|
|
731
|
+
"raw": "TableColumnGroupItem[]",
|
|
732
|
+
"kind": "array"
|
|
733
|
+
},
|
|
734
|
+
"required": false,
|
|
735
|
+
"default": "undefined"
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
"name": "hideGroupHeader",
|
|
739
|
+
"description": "是否隐藏group下拉菜单中header区域",
|
|
740
|
+
"type": {
|
|
741
|
+
"raw": "boolean",
|
|
742
|
+
"kind": "boolean"
|
|
743
|
+
},
|
|
744
|
+
"required": false,
|
|
745
|
+
"default": "false"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
"name": "multiple",
|
|
749
|
+
"description": "分组是否支持多选",
|
|
750
|
+
"type": {
|
|
751
|
+
"raw": "boolean",
|
|
752
|
+
"kind": "boolean"
|
|
753
|
+
},
|
|
754
|
+
"required": false,
|
|
755
|
+
"default": "false"
|
|
756
|
+
},
|
|
757
|
+
{
|
|
758
|
+
"name": "ignore",
|
|
759
|
+
"description": "是否忽略当前列的导出",
|
|
760
|
+
"type": {
|
|
761
|
+
"raw": "boolean",
|
|
762
|
+
"kind": "boolean"
|
|
763
|
+
},
|
|
764
|
+
"required": false,
|
|
765
|
+
"default": "false"
|
|
766
|
+
},
|
|
767
|
+
{
|
|
768
|
+
"name": "fixed",
|
|
769
|
+
"description": "是否将列固定,\"left\"固定在左侧;\"right\"固定在右侧",
|
|
770
|
+
"type": {
|
|
771
|
+
"raw": "\"left\" | \"right\"",
|
|
772
|
+
"kind": "union"
|
|
773
|
+
},
|
|
774
|
+
"required": false,
|
|
775
|
+
"allowedValues": [
|
|
776
|
+
{
|
|
777
|
+
"value": "left",
|
|
778
|
+
"label": "固定在左侧"
|
|
779
|
+
},
|
|
780
|
+
{
|
|
781
|
+
"value": "right",
|
|
782
|
+
"label": "固定在右侧"
|
|
783
|
+
}
|
|
784
|
+
],
|
|
785
|
+
"usageExample": "<TableColumn key=\"id\" title=\"ID\" fixed=\"left\" />"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"name": "align",
|
|
789
|
+
"description": "当前列对齐方式",
|
|
790
|
+
"type": {
|
|
791
|
+
"raw": "\"left\" | \"center\" | \"right\"",
|
|
792
|
+
"kind": "union"
|
|
793
|
+
},
|
|
794
|
+
"required": false,
|
|
795
|
+
"usageExample": "<TableColumn key=\"amount\" title=\"金额\" align=\"right\" />"
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
"name": "exportTitle",
|
|
799
|
+
"description": "自定义导出的标题",
|
|
800
|
+
"type": {
|
|
801
|
+
"raw": "string",
|
|
802
|
+
"kind": "string"
|
|
803
|
+
},
|
|
804
|
+
"required": false,
|
|
805
|
+
"default": "undefined"
|
|
806
|
+
},
|
|
807
|
+
{
|
|
808
|
+
"name": "exportCell",
|
|
809
|
+
"description": "自定义导出的单元格内容",
|
|
810
|
+
"type": {
|
|
811
|
+
"raw": "(data: any, index: number) => string",
|
|
812
|
+
"kind": "function"
|
|
813
|
+
},
|
|
814
|
+
"required": false,
|
|
815
|
+
"default": "undefined"
|
|
816
|
+
},
|
|
817
|
+
{
|
|
818
|
+
"name": "minWidth",
|
|
819
|
+
"description": "指定当前列拖动时的最小宽度,优先级高于Table的minColWidth",
|
|
820
|
+
"type": {
|
|
821
|
+
"raw": "number",
|
|
822
|
+
"kind": "number"
|
|
823
|
+
},
|
|
824
|
+
"required": false,
|
|
825
|
+
"default": "undefined"
|
|
826
|
+
},
|
|
827
|
+
{
|
|
828
|
+
"name": "className",
|
|
829
|
+
"description": "给当前列添加className",
|
|
830
|
+
"type": {
|
|
831
|
+
"raw": "string | Record<string, any>",
|
|
832
|
+
"kind": "union"
|
|
833
|
+
},
|
|
834
|
+
"required": false,
|
|
835
|
+
"default": "undefined"
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
"name": "hidden",
|
|
839
|
+
"description": "是否隐藏当前列,仅为不可见,不影响exportTable导出表格",
|
|
840
|
+
"type": {
|
|
841
|
+
"raw": "boolean",
|
|
842
|
+
"kind": "boolean"
|
|
843
|
+
},
|
|
844
|
+
"required": false,
|
|
845
|
+
"default": "false"
|
|
846
|
+
},
|
|
847
|
+
{
|
|
848
|
+
"name": "ellipsis",
|
|
849
|
+
"description": "是否开启超长省略",
|
|
850
|
+
"type": {
|
|
851
|
+
"raw": "boolean",
|
|
852
|
+
"kind": "boolean"
|
|
853
|
+
},
|
|
854
|
+
"required": false,
|
|
855
|
+
"default": "false",
|
|
856
|
+
"usageExample": "<TableColumn key=\"desc\" title=\"描述\" ellipsis />"
|
|
857
|
+
}
|
|
858
|
+
],
|
|
859
|
+
"slots": [
|
|
860
|
+
{
|
|
861
|
+
"name": "title",
|
|
862
|
+
"description": "自定义复杂表头内容",
|
|
863
|
+
"vueTemplate": "#title",
|
|
864
|
+
"usageExample": "<TableColumn key=\"custom\">\n <template #title>自定义表头</template>\n</TableColumn>"
|
|
865
|
+
},
|
|
866
|
+
{
|
|
867
|
+
"name": "template",
|
|
868
|
+
"description": "自定义单元格内容",
|
|
869
|
+
"slotProps": [
|
|
870
|
+
{
|
|
871
|
+
"name": "data",
|
|
872
|
+
"type": "T",
|
|
873
|
+
"description": "当前行数据",
|
|
874
|
+
"destructuringExample": "[data]"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
"name": "index",
|
|
878
|
+
"type": "number",
|
|
879
|
+
"description": "行索引"
|
|
880
|
+
}
|
|
881
|
+
],
|
|
882
|
+
"vueTemplate": "#template=\"[data, index]\"",
|
|
883
|
+
"usageExample": "<TableColumn key=\"action\" title=\"操作\">\n <template #template=\"[data]\">\n <Button @click=\"handleEdit(data)\">编辑</Button>\n </template>\n</TableColumn>"
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
"name": "default",
|
|
887
|
+
"description": "与template扩展点等价,为了方便vue中使用的别名",
|
|
888
|
+
"slotProps": [
|
|
889
|
+
{
|
|
890
|
+
"name": "data",
|
|
891
|
+
"type": "T",
|
|
892
|
+
"description": "当前行数据",
|
|
893
|
+
"destructuringExample": "[data]"
|
|
894
|
+
},
|
|
895
|
+
{
|
|
896
|
+
"name": "index",
|
|
897
|
+
"type": "number",
|
|
898
|
+
"description": "行索引"
|
|
899
|
+
}
|
|
900
|
+
],
|
|
901
|
+
"vueTemplate": "#default=\"[data, index]\"",
|
|
902
|
+
"usageExample": "<TableColumn key=\"action\" title=\"操作\">\n <template #default=\"[data]\">\n <Button @click=\"handleEdit(data)\">编辑</Button>\n </template>\n</TableColumn>"
|
|
903
|
+
}
|
|
904
|
+
]
|
|
905
|
+
}
|
|
906
|
+
],
|
|
907
|
+
"typeDefinitions": [
|
|
908
|
+
{
|
|
909
|
+
"name": "TableRowKey",
|
|
910
|
+
"definition": "type TableRowKey = string | number;",
|
|
911
|
+
"description": "表格行的唯一标识类型"
|
|
912
|
+
},
|
|
913
|
+
{
|
|
914
|
+
"name": "TableSortValue",
|
|
915
|
+
"definition": "type TableSortValue<T = string> = {\n key?: T;\n type?: 'desc' | 'asc';\n};",
|
|
916
|
+
"description": "排序状态类型"
|
|
917
|
+
}
|
|
918
|
+
],
|
|
919
|
+
"examples": [
|
|
920
|
+
{
|
|
921
|
+
"id": "table_basic",
|
|
922
|
+
"title": "基础表格",
|
|
923
|
+
"description": "展示基本的表格用法",
|
|
924
|
+
"difficulty": "easy",
|
|
925
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Table, TableColumn } from '@king-design/vue';\n\nconst data = ref([\n { name: '张三', age: 25, address: '北京' },\n { name: '李四', age: 30, address: '上海' }\n]);\n</script>\n<template>\n <Table :data=\"data\">\n <TableColumn key=\"name\" title=\"姓名\" />\n <TableColumn key=\"age\" title=\"年龄\" />\n <TableColumn key=\"address\" title=\"地址\" />\n </Table>\n</template>",
|
|
926
|
+
"tags": [
|
|
927
|
+
"basic"
|
|
928
|
+
],
|
|
929
|
+
"usedProps": [
|
|
930
|
+
"data"
|
|
931
|
+
],
|
|
932
|
+
"usedEvents": [],
|
|
933
|
+
"usedSlots": [],
|
|
934
|
+
"usedMethods": [],
|
|
935
|
+
"scenario": "创建一个简单的表格展示用户信息"
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
"id": "table_selectable",
|
|
939
|
+
"title": "可选择表格",
|
|
940
|
+
"description": "支持行选择的表格",
|
|
941
|
+
"difficulty": "medium",
|
|
942
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Table, TableColumn } from '@king-design/vue';\n\nconst data = ref([\n { id: 1, name: '张三' },\n { id: 2, name: '李四' }\n]);\nconst checkedKeys = ref<number[]>([]);\n</script>\n<template>\n <Table :data=\"data\" checkType=\"checkbox\" v-model:checkedKeys=\"checkedKeys\" :rowKey=\"row => row.id\">\n <TableColumn key=\"name\" title=\"姓名\" />\n </Table>\n <p>选中: {{ checkedKeys }}</p>\n</template>",
|
|
943
|
+
"tags": [
|
|
944
|
+
"checkbox",
|
|
945
|
+
"selection",
|
|
946
|
+
"v-model"
|
|
947
|
+
],
|
|
948
|
+
"usedProps": [
|
|
949
|
+
"data",
|
|
950
|
+
"checkType",
|
|
951
|
+
"checkedKeys",
|
|
952
|
+
"rowKey"
|
|
953
|
+
],
|
|
954
|
+
"usedEvents": [],
|
|
955
|
+
"usedSlots": [],
|
|
956
|
+
"usedMethods": [],
|
|
957
|
+
"scenario": "创建一个可多选的表格,支持获取选中行"
|
|
958
|
+
},
|
|
959
|
+
{
|
|
960
|
+
"id": "table_custom_cell",
|
|
961
|
+
"title": "自定义单元格",
|
|
962
|
+
"description": "使用插槽自定义单元格内容",
|
|
963
|
+
"difficulty": "medium",
|
|
964
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Table, TableColumn, Button, Tag } from '@king-design/vue';\n\nconst data = ref([\n { name: '张三', status: 'active' },\n { name: '李四', status: 'inactive' }\n]);\n</script>\n<template>\n <Table :data=\"data\">\n <TableColumn key=\"name\" title=\"姓名\" />\n <TableColumn key=\"status\" title=\"状态\">\n <template #default=\"[row]\">\n <Tag :type=\"row.status === 'active' ? 'success' : 'warning'\">\n {{ row.status === 'active' ? '激活' : '未激活' }}\n </Tag>\n </template>\n </TableColumn>\n <TableColumn key=\"action\" title=\"操作\">\n <template #default=\"[row]\">\n <Button type=\"primary\" size=\"small\">编辑</Button>\n </template>\n </TableColumn>\n </Table>\n</template>",
|
|
965
|
+
"tags": [
|
|
966
|
+
"slot",
|
|
967
|
+
"custom",
|
|
968
|
+
"template"
|
|
969
|
+
],
|
|
970
|
+
"usedProps": [
|
|
971
|
+
"data"
|
|
972
|
+
],
|
|
973
|
+
"usedEvents": [],
|
|
974
|
+
"usedSlots": [
|
|
975
|
+
"default"
|
|
976
|
+
],
|
|
977
|
+
"usedMethods": [],
|
|
978
|
+
"scenario": "创建带有状态标签和操作按钮的表格"
|
|
979
|
+
}
|
|
980
|
+
],
|
|
981
|
+
"commonMistakes": [
|
|
982
|
+
{
|
|
983
|
+
"id": "table_slot_destructuring",
|
|
984
|
+
"description": "TableColumn 作用域插槽参数解构方式错误",
|
|
985
|
+
"wrongCode": "<template #default=\"{ row }\">",
|
|
986
|
+
"correctCode": "<template #default=\"[row]\">",
|
|
987
|
+
"explanation": "KPC 组件库使用数组形式传递作用域插槽参数,而非对象解构。正确写法是 [row] 或 [row, index],不是 { row } 或 { row, index }",
|
|
988
|
+
"relatedProps": []
|
|
989
|
+
},
|
|
990
|
+
{
|
|
991
|
+
"id": "table_missing_key",
|
|
992
|
+
"description": "TableColumn 未设置 key 属性",
|
|
993
|
+
"wrongCode": "<TableColumn title=\"姓名\" />",
|
|
994
|
+
"correctCode": "<TableColumn key=\"name\" title=\"姓名\" />",
|
|
995
|
+
"explanation": "TableColumn 的 key 属性是必须的,用于标识列和数据映射",
|
|
996
|
+
"relatedProps": [
|
|
997
|
+
"key"
|
|
998
|
+
]
|
|
999
|
+
},
|
|
1000
|
+
{
|
|
1001
|
+
"id": "table_rowkey_missing",
|
|
1002
|
+
"description": "使用选择功能时未设置 rowKey",
|
|
1003
|
+
"wrongCode": "<Table :data=\"data\" checkType=\"checkbox\" v-model:checkedKeys=\"keys\">",
|
|
1004
|
+
"correctCode": "<Table :data=\"data\" checkType=\"checkbox\" v-model:checkedKeys=\"keys\" :rowKey=\"row => row.id\">",
|
|
1005
|
+
"explanation": "使用 checkType 进行行选择时,应该设置 rowKey 来唯一标识每行,否则默认使用数组索引,数据变化时可能导致选中状态错乱",
|
|
1006
|
+
"relatedProps": [
|
|
1007
|
+
"checkType",
|
|
1008
|
+
"rowKey",
|
|
1009
|
+
"checkedKeys"
|
|
1010
|
+
]
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
"id": "table_column_prop_error",
|
|
1014
|
+
"description": "TableColumn 错误使用 prop 属性",
|
|
1015
|
+
"wrongCode": "<TableColumn prop=\"name\" />",
|
|
1016
|
+
"correctCode": "<TableColumn key=\"name\" />",
|
|
1017
|
+
"explanation": "KPC TableColumn 使用 `key` 属性来指定数据字段,而不是 `prop`。",
|
|
1018
|
+
"relatedProps": [
|
|
1019
|
+
"key"
|
|
1020
|
+
]
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"id": "table_column_label_error",
|
|
1024
|
+
"description": "TableColumn 错误使用 label 属性",
|
|
1025
|
+
"wrongCode": "<TableColumn label=\"姓名\" />",
|
|
1026
|
+
"correctCode": "<TableColumn title=\"姓名\" />",
|
|
1027
|
+
"explanation": "KPC TableColumn 使用 `title` 属性来指定列标题,而不是 `label`。",
|
|
1028
|
+
"relatedProps": [
|
|
1029
|
+
"title"
|
|
1030
|
+
]
|
|
1031
|
+
}
|
|
1032
|
+
],
|
|
1033
|
+
"searchKeywords": [
|
|
1034
|
+
"表格",
|
|
1035
|
+
"table",
|
|
1036
|
+
"列表",
|
|
1037
|
+
"数据展示",
|
|
1038
|
+
"选择",
|
|
1039
|
+
"排序",
|
|
1040
|
+
"分页",
|
|
1041
|
+
"固定列",
|
|
1042
|
+
"树形",
|
|
1043
|
+
"虚拟滚动"
|
|
1044
|
+
],
|
|
1045
|
+
"useCases": [
|
|
1046
|
+
"用户列表展示",
|
|
1047
|
+
"可选择的数据表格",
|
|
1048
|
+
"带分页的数据列表",
|
|
1049
|
+
"固定表头的长表格",
|
|
1050
|
+
"可排序的数据分析表格",
|
|
1051
|
+
"带操作列的管理表格"
|
|
1052
|
+
],
|
|
1053
|
+
"relatedComponents": [
|
|
1054
|
+
"TableColumn",
|
|
1055
|
+
"Pagination"
|
|
1056
|
+
]
|
|
1057
|
+
}
|