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,460 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "dialog",
|
|
3
|
+
"name": "Dialog",
|
|
4
|
+
"displayName": "弹窗",
|
|
5
|
+
"category": "feedback",
|
|
6
|
+
"description": "模态对话框,用于需要用户处理事务又不希望跳转页面的场景,支持拖拽、自定义内容和底部按钮",
|
|
7
|
+
"importStatement": "import { Dialog, Button } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "value",
|
|
11
|
+
"description": "弹窗是否展示,可用v-model双向绑定",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "boolean",
|
|
14
|
+
"kind": "boolean"
|
|
15
|
+
},
|
|
16
|
+
"required": false,
|
|
17
|
+
"default": "false",
|
|
18
|
+
"usageExample": "<Dialog v-model=\"visible\">"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "title",
|
|
22
|
+
"description": "弹窗标题",
|
|
23
|
+
"type": {
|
|
24
|
+
"raw": "string",
|
|
25
|
+
"kind": "string"
|
|
26
|
+
},
|
|
27
|
+
"required": false,
|
|
28
|
+
"default": "\"提示\"",
|
|
29
|
+
"usageExample": "<Dialog v-model=\"visible\" title=\"确认操作\">"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "size",
|
|
33
|
+
"description": "弹窗尺寸",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
|
|
36
|
+
"kind": "union",
|
|
37
|
+
"unionTypes": [
|
|
38
|
+
"large",
|
|
39
|
+
"default",
|
|
40
|
+
"small",
|
|
41
|
+
"mini"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"default": "\"default\"",
|
|
46
|
+
"allowedValues": [
|
|
47
|
+
{
|
|
48
|
+
"value": "large",
|
|
49
|
+
"label": "大尺寸"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"value": "default",
|
|
53
|
+
"label": "默认尺寸",
|
|
54
|
+
"isDefault": true
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"value": "small",
|
|
58
|
+
"label": "小尺寸"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"value": "mini",
|
|
62
|
+
"label": "迷你尺寸"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"usageExample": "<Dialog v-model=\"visible\" size=\"small\">"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "width",
|
|
69
|
+
"description": "指定弹窗宽度,number类型时单位为px,string类型需要指定单位",
|
|
70
|
+
"type": {
|
|
71
|
+
"raw": "number | string",
|
|
72
|
+
"kind": "union"
|
|
73
|
+
},
|
|
74
|
+
"required": false,
|
|
75
|
+
"default": "undefined",
|
|
76
|
+
"usageExample": "<Dialog v-model=\"visible\" :width=\"800\">"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"name": "loading",
|
|
80
|
+
"description": "\"确定\"按钮是否为加载状态",
|
|
81
|
+
"type": {
|
|
82
|
+
"raw": "boolean",
|
|
83
|
+
"kind": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"required": false,
|
|
86
|
+
"default": "false",
|
|
87
|
+
"usageExample": "<Dialog v-model=\"visible\" :loading=\"isSubmitting\">"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "disabledOk",
|
|
91
|
+
"description": "\"确定\"按钮是否为禁用状态",
|
|
92
|
+
"type": {
|
|
93
|
+
"raw": "boolean",
|
|
94
|
+
"kind": "boolean"
|
|
95
|
+
},
|
|
96
|
+
"required": false,
|
|
97
|
+
"default": "false",
|
|
98
|
+
"usageExample": "<Dialog v-model=\"visible\" :disabledOk=\"!isValid\">"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "okText",
|
|
102
|
+
"description": "\"确定\"按钮文案",
|
|
103
|
+
"type": {
|
|
104
|
+
"raw": "string",
|
|
105
|
+
"kind": "string"
|
|
106
|
+
},
|
|
107
|
+
"required": false,
|
|
108
|
+
"default": "\"确定\"",
|
|
109
|
+
"usageExample": "<Dialog v-model=\"visible\" okText=\"保存\">"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "cancelText",
|
|
113
|
+
"description": "\"取消\"按钮文案",
|
|
114
|
+
"type": {
|
|
115
|
+
"raw": "string",
|
|
116
|
+
"kind": "string"
|
|
117
|
+
},
|
|
118
|
+
"required": false,
|
|
119
|
+
"default": "\"取消\"",
|
|
120
|
+
"usageExample": "<Dialog v-model=\"visible\" cancelText=\"放弃\">"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"name": "overlay",
|
|
124
|
+
"description": "是否展示遮罩层",
|
|
125
|
+
"type": {
|
|
126
|
+
"raw": "boolean",
|
|
127
|
+
"kind": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"default": "true",
|
|
131
|
+
"usageExample": "<Dialog v-model=\"visible\" :overlay=\"false\">"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"name": "closable",
|
|
135
|
+
"description": "点击遮罩层是否可以关闭弹窗",
|
|
136
|
+
"type": {
|
|
137
|
+
"raw": "boolean",
|
|
138
|
+
"kind": "boolean"
|
|
139
|
+
},
|
|
140
|
+
"required": false,
|
|
141
|
+
"default": "true",
|
|
142
|
+
"usageExample": "<Dialog v-model=\"visible\" :closable=\"false\">"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "escClosable",
|
|
146
|
+
"description": "是否按ESC键关闭弹窗",
|
|
147
|
+
"type": {
|
|
148
|
+
"raw": "boolean",
|
|
149
|
+
"kind": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"required": false,
|
|
152
|
+
"default": "true",
|
|
153
|
+
"usageExample": "<Dialog v-model=\"visible\" :escClosable=\"false\">"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "hideClose",
|
|
157
|
+
"description": "是否隐藏右上角关闭按钮",
|
|
158
|
+
"type": {
|
|
159
|
+
"raw": "boolean",
|
|
160
|
+
"kind": "boolean"
|
|
161
|
+
},
|
|
162
|
+
"required": false,
|
|
163
|
+
"default": "false",
|
|
164
|
+
"usageExample": "<Dialog v-model=\"visible\" hideClose>"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "draggable",
|
|
168
|
+
"description": "弹窗是否可拖拽",
|
|
169
|
+
"type": {
|
|
170
|
+
"raw": "boolean",
|
|
171
|
+
"kind": "boolean"
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"default": "true",
|
|
175
|
+
"usageExample": "<Dialog v-model=\"visible\" :draggable=\"false\">"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "mode",
|
|
179
|
+
"description": "指定主体元素在关闭状态下的渲染方式",
|
|
180
|
+
"type": {
|
|
181
|
+
"raw": "\"destroy\" | \"hide\"",
|
|
182
|
+
"kind": "union",
|
|
183
|
+
"unionTypes": [
|
|
184
|
+
"destroy",
|
|
185
|
+
"hide"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"default": "\"hide\"",
|
|
190
|
+
"allowedValues": [
|
|
191
|
+
{
|
|
192
|
+
"value": "hide",
|
|
193
|
+
"label": "只是隐藏,保留DOM",
|
|
194
|
+
"isDefault": true
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"value": "destroy",
|
|
198
|
+
"label": "直接销毁DOM"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"usageExample": "<Dialog v-model=\"visible\" mode=\"destroy\">"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"events": [
|
|
205
|
+
{
|
|
206
|
+
"name": "open",
|
|
207
|
+
"vueEventName": "@open",
|
|
208
|
+
"description": "弹窗打开后触发",
|
|
209
|
+
"payload": [],
|
|
210
|
+
"usageExample": "<Dialog v-model=\"visible\" @open=\"handleOpen\">",
|
|
211
|
+
"handlerExample": "const handleOpen = () => {\n console.log('弹窗已打开');\n};"
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"name": "close",
|
|
215
|
+
"vueEventName": "@close",
|
|
216
|
+
"description": "弹窗关闭后触发,不管是什么原因导致的关闭",
|
|
217
|
+
"payload": [],
|
|
218
|
+
"usageExample": "<Dialog v-model=\"visible\" @close=\"handleClose\">",
|
|
219
|
+
"handlerExample": "const handleClose = () => {\n console.log('弹窗已关闭');\n};"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "ok",
|
|
223
|
+
"vueEventName": "@ok",
|
|
224
|
+
"description": "点击确定按钮时触发",
|
|
225
|
+
"payload": [],
|
|
226
|
+
"usageExample": "<Dialog v-model=\"visible\" @ok=\"handleOk\">",
|
|
227
|
+
"handlerExample": "const handleOk = () => {\n // 处理确定逻辑\n visible.value = false;\n};"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"name": "cancel",
|
|
231
|
+
"vueEventName": "@cancel",
|
|
232
|
+
"description": "点击取消按钮时触发",
|
|
233
|
+
"payload": [],
|
|
234
|
+
"usageExample": "<Dialog v-model=\"visible\" @cancel=\"handleCancel\">",
|
|
235
|
+
"handlerExample": "const handleCancel = () => {\n visible.value = false;\n};"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "terminate",
|
|
239
|
+
"vueEventName": "@terminate",
|
|
240
|
+
"description": "用户强行关闭弹窗时触发:点击关闭按钮、点击遮罩层、按ESC键",
|
|
241
|
+
"payload": [],
|
|
242
|
+
"usageExample": "<Dialog v-model=\"visible\" @terminate=\"handleTerminate\">",
|
|
243
|
+
"handlerExample": "const handleTerminate = () => {\n console.log('用户强行关闭了弹窗');\n};"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "afterClose",
|
|
247
|
+
"vueEventName": "@after-close",
|
|
248
|
+
"description": "弹窗退出动画执行完成后触发",
|
|
249
|
+
"payload": [],
|
|
250
|
+
"usageExample": "<Dialog v-model=\"visible\" @after-close=\"handleAfterClose\">",
|
|
251
|
+
"handlerExample": "const handleAfterClose = () => {\n // 动画完成后清理\n};"
|
|
252
|
+
}
|
|
253
|
+
],
|
|
254
|
+
"slots": [
|
|
255
|
+
{
|
|
256
|
+
"name": "content",
|
|
257
|
+
"description": "定义整个弹窗体,包括header,body,footer",
|
|
258
|
+
"vueTemplate": "#content",
|
|
259
|
+
"usageExample": "<Dialog v-model=\"visible\">\n <template #content>\n <!-- 完全自定义弹窗结构 -->\n </template>\n</Dialog>"
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
"name": "header",
|
|
263
|
+
"description": "扩展弹窗头部",
|
|
264
|
+
"vueTemplate": "#header",
|
|
265
|
+
"usageExample": "<Dialog v-model=\"visible\">\n <template #header>\n <h2>自定义头部</h2>\n </template>\n</Dialog>"
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"name": "body",
|
|
269
|
+
"description": "扩展弹窗主体部分",
|
|
270
|
+
"vueTemplate": "#body"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"name": "footer",
|
|
274
|
+
"description": "扩展弹窗底部",
|
|
275
|
+
"vueTemplate": "#footer",
|
|
276
|
+
"usageExample": "<Dialog v-model=\"visible\">\n <template #footer>\n <Button @click=\"visible = false\">关闭</Button>\n <Button type=\"primary\" @click=\"handleSubmit\">提交</Button>\n </template>\n</Dialog>"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"name": "footerWrapper",
|
|
280
|
+
"description": "扩展弹窗整个底部,上述footer是它下面一个子扩展点",
|
|
281
|
+
"vueTemplate": "#footerWrapper"
|
|
282
|
+
}
|
|
283
|
+
],
|
|
284
|
+
"methods": [
|
|
285
|
+
{
|
|
286
|
+
"name": "show",
|
|
287
|
+
"description": "弹出弹窗",
|
|
288
|
+
"params": [],
|
|
289
|
+
"returnType": "Promise",
|
|
290
|
+
"usageExample": "const dialogRef = ref<InstanceType<typeof Dialog>>();\nawait dialogRef.value?.show();"
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
"name": "close",
|
|
294
|
+
"description": "关闭弹窗",
|
|
295
|
+
"params": [],
|
|
296
|
+
"returnType": "void",
|
|
297
|
+
"usageExample": "dialogRef.value?.close();"
|
|
298
|
+
},
|
|
299
|
+
{
|
|
300
|
+
"name": "showLoading",
|
|
301
|
+
"description": "\"确定\"按钮变为加载状态",
|
|
302
|
+
"params": [],
|
|
303
|
+
"returnType": "void",
|
|
304
|
+
"usageExample": "dialogRef.value?.showLoading();"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"name": "hideLoading",
|
|
308
|
+
"description": "\"确定\"按钮变为正常状态",
|
|
309
|
+
"params": [],
|
|
310
|
+
"returnType": "void",
|
|
311
|
+
"usageExample": "dialogRef.value?.hideLoading();"
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"typeDefinitions": [
|
|
315
|
+
{
|
|
316
|
+
"name": "DialogOptions",
|
|
317
|
+
"definition": "interface DialogOptions {\n title?: string;\n content?: string | VNode;\n size?: 'large' | 'default' | 'small' | 'mini';\n hideIcon?: boolean;\n hideFooter?: boolean;\n okText?: string;\n cancelText?: string;\n}",
|
|
318
|
+
"description": "静态方法调用时的配置选项"
|
|
319
|
+
}
|
|
320
|
+
],
|
|
321
|
+
"examples": [
|
|
322
|
+
{
|
|
323
|
+
"id": "dialog_basic",
|
|
324
|
+
"title": "基础弹窗",
|
|
325
|
+
"description": "通过v-model控制弹窗显隐",
|
|
326
|
+
"difficulty": "easy",
|
|
327
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Dialog, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开弹窗</Button>\n <Dialog v-model=\"visible\" title=\"提示\">\n <p>这是弹窗内容</p>\n </Dialog>\n</template>",
|
|
328
|
+
"tags": [
|
|
329
|
+
"basic",
|
|
330
|
+
"v-model"
|
|
331
|
+
],
|
|
332
|
+
"usedProps": [
|
|
333
|
+
"value",
|
|
334
|
+
"title"
|
|
335
|
+
],
|
|
336
|
+
"usedEvents": [],
|
|
337
|
+
"usedSlots": [
|
|
338
|
+
"default"
|
|
339
|
+
],
|
|
340
|
+
"usedMethods": [],
|
|
341
|
+
"scenario": "创建一个基本的确认弹窗"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"id": "dialog_confirm",
|
|
345
|
+
"title": "确认对话框",
|
|
346
|
+
"description": "使用静态方法创建确认对话框",
|
|
347
|
+
"difficulty": "medium",
|
|
348
|
+
"code": "<script setup lang=\"ts\">\nimport { Dialog, Button } from '@king-design/vue';\n\nconst handleDelete = async () => {\n try {\n await Dialog.confirm({\n title: '确认删除',\n content: '确定要删除这条数据吗?此操作不可恢复。'\n });\n console.log('用户点击了确定');\n } catch (e) {\n console.log('用户点击了取消');\n }\n};\n</script>\n<template>\n <Button type=\"danger\" @click=\"handleDelete\">删除</Button>\n</template>",
|
|
349
|
+
"tags": [
|
|
350
|
+
"confirm",
|
|
351
|
+
"static",
|
|
352
|
+
"async"
|
|
353
|
+
],
|
|
354
|
+
"usedProps": [],
|
|
355
|
+
"usedEvents": [],
|
|
356
|
+
"usedSlots": [],
|
|
357
|
+
"usedMethods": [],
|
|
358
|
+
"scenario": "使用Dialog.confirm静态方法创建删除确认对话框"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"id": "dialog_async_submit",
|
|
362
|
+
"title": "异步提交弹窗",
|
|
363
|
+
"description": "点击确定后显示loading状态",
|
|
364
|
+
"difficulty": "medium",
|
|
365
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Dialog, Button } from '@king-design/vue';\n\nconst visible = ref(false);\nconst loading = ref(false);\n\nconst handleOk = async () => {\n loading.value = true;\n await new Promise(resolve => setTimeout(resolve, 2000));\n loading.value = false;\n visible.value = false;\n};\n</script>\n<template>\n <Button @click=\"visible = true\">打开弹窗</Button>\n <Dialog v-model=\"visible\" title=\"提交数据\" :loading=\"loading\" @ok=\"handleOk\">\n <p>点击确定提交数据...</p>\n </Dialog>\n</template>",
|
|
366
|
+
"tags": [
|
|
367
|
+
"loading",
|
|
368
|
+
"async",
|
|
369
|
+
"submit"
|
|
370
|
+
],
|
|
371
|
+
"usedProps": [
|
|
372
|
+
"value",
|
|
373
|
+
"title",
|
|
374
|
+
"loading"
|
|
375
|
+
],
|
|
376
|
+
"usedEvents": [
|
|
377
|
+
"ok"
|
|
378
|
+
],
|
|
379
|
+
"usedSlots": [
|
|
380
|
+
"default"
|
|
381
|
+
],
|
|
382
|
+
"usedMethods": [],
|
|
383
|
+
"scenario": "创建带异步提交功能的弹窗,确定按钮显示loading状态"
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"id": "dialog_custom_footer",
|
|
387
|
+
"title": "自定义底部按钮",
|
|
388
|
+
"description": "使用footer插槽自定义底部按钮",
|
|
389
|
+
"difficulty": "medium",
|
|
390
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Dialog, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开弹窗</Button>\n <Dialog v-model=\"visible\" title=\"自定义底部\">\n <p>弹窗内容</p>\n <template #footer>\n <Button @click=\"visible = false\">稍后再说</Button>\n <Button type=\"primary\" @click=\"visible = false\">立即处理</Button>\n <Button type=\"danger\" @click=\"visible = false\">删除</Button>\n </template>\n </Dialog>\n</template>",
|
|
391
|
+
"tags": [
|
|
392
|
+
"slot",
|
|
393
|
+
"footer",
|
|
394
|
+
"custom"
|
|
395
|
+
],
|
|
396
|
+
"usedProps": [
|
|
397
|
+
"value",
|
|
398
|
+
"title"
|
|
399
|
+
],
|
|
400
|
+
"usedEvents": [],
|
|
401
|
+
"usedSlots": [
|
|
402
|
+
"default",
|
|
403
|
+
"footer"
|
|
404
|
+
],
|
|
405
|
+
"usedMethods": [],
|
|
406
|
+
"scenario": "创建带有多个自定义按钮的弹窗"
|
|
407
|
+
}
|
|
408
|
+
],
|
|
409
|
+
"commonMistakes": [
|
|
410
|
+
{
|
|
411
|
+
"id": "dialog_static_import",
|
|
412
|
+
"description": "静态方法调用时未正确导入Dialog",
|
|
413
|
+
"wrongCode": "import { confirm } from '@king-design/vue';\nconfirm({ title: '确认' });",
|
|
414
|
+
"correctCode": "import { Dialog } from '@king-design/vue';\nDialog.confirm({ title: '确认' });",
|
|
415
|
+
"explanation": "confirm、success、warning、error是Dialog的静态方法,需要通过Dialog.xxx()调用",
|
|
416
|
+
"relatedProps": []
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"id": "dialog_ok_event_close",
|
|
420
|
+
"description": "@ok事件中未关闭弹窗",
|
|
421
|
+
"wrongCode": "const handleOk = () => {\n // 只处理业务逻辑,忘记关闭弹窗\n submitData();\n};",
|
|
422
|
+
"correctCode": "const handleOk = () => {\n submitData();\n visible.value = false; // 需要手动关闭\n};",
|
|
423
|
+
"explanation": "使用@ok事件时,弹窗不会自动关闭,需要在处理函数中手动设置visible为false",
|
|
424
|
+
"relatedEvents": [
|
|
425
|
+
"ok"
|
|
426
|
+
]
|
|
427
|
+
},
|
|
428
|
+
{
|
|
429
|
+
"id": "dialog_vmodel_syntax",
|
|
430
|
+
"description": "v-model语法错误",
|
|
431
|
+
"wrongCode": "<Dialog :value=\"visible\" @update:value=\"visible = $event\">",
|
|
432
|
+
"correctCode": "<Dialog v-model=\"visible\">",
|
|
433
|
+
"explanation": "Vue 3中应使用v-model语法糖,不需要手动拆分:value和@update:value",
|
|
434
|
+
"relatedProps": [
|
|
435
|
+
"value"
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
],
|
|
439
|
+
"searchKeywords": [
|
|
440
|
+
"弹窗",
|
|
441
|
+
"对话框",
|
|
442
|
+
"dialog",
|
|
443
|
+
"modal",
|
|
444
|
+
"confirm",
|
|
445
|
+
"确认",
|
|
446
|
+
"提示",
|
|
447
|
+
"警告"
|
|
448
|
+
],
|
|
449
|
+
"useCases": [
|
|
450
|
+
"删除确认对话框",
|
|
451
|
+
"表单提交弹窗",
|
|
452
|
+
"详情查看弹窗",
|
|
453
|
+
"操作成功/失败提示",
|
|
454
|
+
"自定义内容弹窗"
|
|
455
|
+
],
|
|
456
|
+
"relatedComponents": [
|
|
457
|
+
"Button",
|
|
458
|
+
"Message"
|
|
459
|
+
]
|
|
460
|
+
}
|