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,563 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "drawer",
|
|
3
|
+
"name": "Drawer",
|
|
4
|
+
"displayName": "抽屉",
|
|
5
|
+
"category": "feedback",
|
|
6
|
+
"description": "抽屉组件,从屏幕边缘滑出的浮层面板。支持从四个方向弹出,常用于承载详情信息、表单编辑等场景。与 Dialog 类似但更适合承载较多内容。",
|
|
7
|
+
"importStatement": "import { Drawer } 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": "<Drawer 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": "<Drawer title=\"抽屉标题\">"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "placement",
|
|
33
|
+
"description": "抽屉弹出的位置",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "\"top\" | \"bottom\" | \"left\" | \"right\"",
|
|
36
|
+
"kind": "union",
|
|
37
|
+
"unionTypes": [
|
|
38
|
+
"top",
|
|
39
|
+
"bottom",
|
|
40
|
+
"left",
|
|
41
|
+
"right"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"required": false,
|
|
45
|
+
"default": "\"right\"",
|
|
46
|
+
"allowedValues": [
|
|
47
|
+
{
|
|
48
|
+
"value": "right",
|
|
49
|
+
"label": "从右侧弹出",
|
|
50
|
+
"isDefault": true
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"value": "left",
|
|
54
|
+
"label": "从左侧弹出"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"value": "top",
|
|
58
|
+
"label": "从顶部弹出"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"value": "bottom",
|
|
62
|
+
"label": "从底部弹出"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"usageExample": "<Drawer placement=\"left\">"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "size",
|
|
69
|
+
"description": "抽屉尺寸",
|
|
70
|
+
"type": {
|
|
71
|
+
"raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
|
|
72
|
+
"kind": "union",
|
|
73
|
+
"unionTypes": [
|
|
74
|
+
"large",
|
|
75
|
+
"default",
|
|
76
|
+
"small",
|
|
77
|
+
"mini"
|
|
78
|
+
]
|
|
79
|
+
},
|
|
80
|
+
"required": false,
|
|
81
|
+
"default": "\"default\"",
|
|
82
|
+
"allowedValues": [
|
|
83
|
+
{
|
|
84
|
+
"value": "large",
|
|
85
|
+
"label": "大尺寸"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"value": "default",
|
|
89
|
+
"label": "默认尺寸",
|
|
90
|
+
"isDefault": true
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"value": "small",
|
|
94
|
+
"label": "小尺寸"
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"value": "mini",
|
|
98
|
+
"label": "迷你尺寸"
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"usageExample": "<Drawer size=\"large\">"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "width",
|
|
105
|
+
"description": "指定抽屉宽度,number 类型时单位为 px,string 类型需指定单位",
|
|
106
|
+
"type": {
|
|
107
|
+
"raw": "number | string",
|
|
108
|
+
"kind": "union"
|
|
109
|
+
},
|
|
110
|
+
"required": false,
|
|
111
|
+
"default": "undefined",
|
|
112
|
+
"usageExample": "<Drawer :width=\"500\">"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"name": "loading",
|
|
116
|
+
"description": "\"确定\"按钮是否为加载状态",
|
|
117
|
+
"type": {
|
|
118
|
+
"raw": "boolean",
|
|
119
|
+
"kind": "boolean"
|
|
120
|
+
},
|
|
121
|
+
"required": false,
|
|
122
|
+
"default": "false",
|
|
123
|
+
"usageExample": "<Drawer :loading=\"isSubmitting\">"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "disabledOk",
|
|
127
|
+
"description": "\"确定\"按钮是否为禁用状态",
|
|
128
|
+
"type": {
|
|
129
|
+
"raw": "boolean",
|
|
130
|
+
"kind": "boolean"
|
|
131
|
+
},
|
|
132
|
+
"required": false,
|
|
133
|
+
"default": "false",
|
|
134
|
+
"usageExample": "<Drawer :disabledOk=\"!isFormValid\">"
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
"name": "okText",
|
|
138
|
+
"description": "\"确定\"按钮文案",
|
|
139
|
+
"type": {
|
|
140
|
+
"raw": "string",
|
|
141
|
+
"kind": "string"
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"default": "\"确定\"",
|
|
145
|
+
"usageExample": "<Drawer okText=\"保存\">"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "cancelText",
|
|
149
|
+
"description": "\"取消\"按钮文案",
|
|
150
|
+
"type": {
|
|
151
|
+
"raw": "string",
|
|
152
|
+
"kind": "string"
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"default": "\"取消\"",
|
|
156
|
+
"usageExample": "<Drawer cancelText=\"关闭\">"
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "ok",
|
|
160
|
+
"description": "\"确定\"按钮点击后自定义回调函数",
|
|
161
|
+
"type": {
|
|
162
|
+
"raw": "() => void",
|
|
163
|
+
"kind": "function",
|
|
164
|
+
"functionSignature": "() => void"
|
|
165
|
+
},
|
|
166
|
+
"required": false,
|
|
167
|
+
"default": "undefined",
|
|
168
|
+
"usageExample": "<Drawer :ok=\"handleOk\">"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "cancel",
|
|
172
|
+
"description": "\"取消\"按钮点击后自定义回调函数",
|
|
173
|
+
"type": {
|
|
174
|
+
"raw": "() => void",
|
|
175
|
+
"kind": "function",
|
|
176
|
+
"functionSignature": "() => void"
|
|
177
|
+
},
|
|
178
|
+
"required": false,
|
|
179
|
+
"default": "undefined",
|
|
180
|
+
"usageExample": "<Drawer :cancel=\"handleCancel\">"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "hideClose",
|
|
184
|
+
"description": "是否隐藏右上角关闭按钮",
|
|
185
|
+
"type": {
|
|
186
|
+
"raw": "boolean",
|
|
187
|
+
"kind": "boolean"
|
|
188
|
+
},
|
|
189
|
+
"required": false,
|
|
190
|
+
"default": "false",
|
|
191
|
+
"usageExample": "<Drawer hideClose>"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"name": "overlay",
|
|
195
|
+
"description": "是否展示遮罩层",
|
|
196
|
+
"type": {
|
|
197
|
+
"raw": "boolean",
|
|
198
|
+
"kind": "boolean"
|
|
199
|
+
},
|
|
200
|
+
"required": false,
|
|
201
|
+
"default": "true",
|
|
202
|
+
"usageExample": "<Drawer :overlay=\"false\">"
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "closable",
|
|
206
|
+
"description": "点击遮罩层是否可以关闭抽屉",
|
|
207
|
+
"type": {
|
|
208
|
+
"raw": "boolean",
|
|
209
|
+
"kind": "boolean"
|
|
210
|
+
},
|
|
211
|
+
"required": false,
|
|
212
|
+
"default": "true",
|
|
213
|
+
"usageExample": "<Drawer :closable=\"false\">"
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
"name": "escClosable",
|
|
217
|
+
"description": "是否按 ESC 键时关闭抽屉",
|
|
218
|
+
"type": {
|
|
219
|
+
"raw": "boolean",
|
|
220
|
+
"kind": "boolean"
|
|
221
|
+
},
|
|
222
|
+
"required": false,
|
|
223
|
+
"default": "true",
|
|
224
|
+
"usageExample": "<Drawer :escClosable=\"false\">"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "terminate",
|
|
228
|
+
"description": "用户点击关闭按钮、遮罩层或按 ESC 键时的回调函数",
|
|
229
|
+
"type": {
|
|
230
|
+
"raw": "() => void",
|
|
231
|
+
"kind": "function",
|
|
232
|
+
"functionSignature": "() => void"
|
|
233
|
+
},
|
|
234
|
+
"required": false,
|
|
235
|
+
"default": "undefined",
|
|
236
|
+
"usageExample": "<Drawer :terminate=\"handleTerminate\">"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"name": "container",
|
|
240
|
+
"description": "指定抽屉插入的位置,默认追加到 body",
|
|
241
|
+
"type": {
|
|
242
|
+
"raw": "string | ((parentDom: Element, anchor: Node | null) => Element)",
|
|
243
|
+
"kind": "union"
|
|
244
|
+
},
|
|
245
|
+
"required": false,
|
|
246
|
+
"default": "undefined",
|
|
247
|
+
"usageExample": "<Drawer :container=\"() => document.body\">"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"name": "mode",
|
|
251
|
+
"description": "指定关闭状态下的渲染方式",
|
|
252
|
+
"type": {
|
|
253
|
+
"raw": "\"destroy\" | \"hide\"",
|
|
254
|
+
"kind": "union",
|
|
255
|
+
"unionTypes": [
|
|
256
|
+
"destroy",
|
|
257
|
+
"hide"
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
"required": false,
|
|
261
|
+
"default": "\"hide\"",
|
|
262
|
+
"allowedValues": [
|
|
263
|
+
{
|
|
264
|
+
"value": "hide",
|
|
265
|
+
"label": "隐藏但保留 DOM",
|
|
266
|
+
"isDefault": true
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"value": "destroy",
|
|
270
|
+
"label": "销毁 DOM"
|
|
271
|
+
}
|
|
272
|
+
],
|
|
273
|
+
"usageExample": "<Drawer mode=\"destroy\">"
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"events": [
|
|
277
|
+
{
|
|
278
|
+
"name": "open",
|
|
279
|
+
"vueEventName": "@open",
|
|
280
|
+
"description": "抽屉打开后触发",
|
|
281
|
+
"payload": [],
|
|
282
|
+
"usageExample": "<Drawer @open=\"handleOpen\">",
|
|
283
|
+
"handlerExample": "const handleOpen = () => {\n console.log('抽屉已打开');\n};"
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"name": "close",
|
|
287
|
+
"vueEventName": "@close",
|
|
288
|
+
"description": "抽屉关闭后触发,不管是什么原因导致的关闭",
|
|
289
|
+
"payload": [],
|
|
290
|
+
"usageExample": "<Drawer @close=\"handleClose\">",
|
|
291
|
+
"handlerExample": "const handleClose = () => {\n console.log('抽屉已关闭');\n};"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"name": "ok",
|
|
295
|
+
"vueEventName": "@ok",
|
|
296
|
+
"description": "点击确定按钮时触发",
|
|
297
|
+
"payload": [],
|
|
298
|
+
"usageExample": "<Drawer @ok=\"handleOk\">",
|
|
299
|
+
"handlerExample": "const handleOk = () => {\n console.log('点击了确定');\n};"
|
|
300
|
+
},
|
|
301
|
+
{
|
|
302
|
+
"name": "cancel",
|
|
303
|
+
"vueEventName": "@cancel",
|
|
304
|
+
"description": "点击取消按钮时触发",
|
|
305
|
+
"payload": [],
|
|
306
|
+
"usageExample": "<Drawer @cancel=\"handleCancel\">",
|
|
307
|
+
"handlerExample": "const handleCancel = () => {\n console.log('点击了取消');\n};"
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
"name": "terminate",
|
|
311
|
+
"vueEventName": "@terminate",
|
|
312
|
+
"description": "用户强行关闭抽屉时触发(点击关闭按钮、遮罩层或按 ESC)",
|
|
313
|
+
"payload": [],
|
|
314
|
+
"usageExample": "<Drawer @terminate=\"handleTerminate\">",
|
|
315
|
+
"handlerExample": "const handleTerminate = () => {\n console.log('用户强行关闭');\n};"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "afterClose",
|
|
319
|
+
"vueEventName": "@afterClose",
|
|
320
|
+
"description": "抽屉退出动画执行完成后触发",
|
|
321
|
+
"payload": [],
|
|
322
|
+
"usageExample": "<Drawer @afterClose=\"handleAfterClose\">",
|
|
323
|
+
"handlerExample": "const handleAfterClose = () => {\n console.log('动画完成');\n};"
|
|
324
|
+
}
|
|
325
|
+
],
|
|
326
|
+
"methods": [
|
|
327
|
+
{
|
|
328
|
+
"name": "show",
|
|
329
|
+
"description": "弹出抽屉",
|
|
330
|
+
"params": [],
|
|
331
|
+
"returnType": "Promise",
|
|
332
|
+
"usageExample": "drawerRef.value?.show();"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"name": "close",
|
|
336
|
+
"description": "关闭抽屉",
|
|
337
|
+
"params": [],
|
|
338
|
+
"returnType": "void",
|
|
339
|
+
"usageExample": "drawerRef.value?.close();"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"name": "showLoading",
|
|
343
|
+
"description": "\"确定\"按钮变为加载状态",
|
|
344
|
+
"params": [],
|
|
345
|
+
"returnType": "void",
|
|
346
|
+
"usageExample": "drawerRef.value?.showLoading();"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
"name": "hideLoading",
|
|
350
|
+
"description": "\"确定\"按钮变为正常状态",
|
|
351
|
+
"params": [],
|
|
352
|
+
"returnType": "void",
|
|
353
|
+
"usageExample": "drawerRef.value?.hideLoading();"
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"name": "disableOk",
|
|
357
|
+
"description": "\"确定\"按钮变为禁用状态",
|
|
358
|
+
"params": [],
|
|
359
|
+
"returnType": "void",
|
|
360
|
+
"usageExample": "drawerRef.value?.disableOk();"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
"name": "enableOk",
|
|
364
|
+
"description": "\"确定\"按钮变为正常状态",
|
|
365
|
+
"params": [],
|
|
366
|
+
"returnType": "void",
|
|
367
|
+
"usageExample": "drawerRef.value?.enableOk();"
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
"slots": [
|
|
371
|
+
{
|
|
372
|
+
"name": "content",
|
|
373
|
+
"description": "定义整个弹窗体,包括header,body,footer"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"name": "header",
|
|
377
|
+
"description": "扩展弹窗头部"
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
"name": "body",
|
|
381
|
+
"description": "扩展弹窗主体部分"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "footer",
|
|
385
|
+
"description": "扩展弹窗底部"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
"name": "footer-wrapper",
|
|
389
|
+
"description": "扩展弹窗整个底部,上述footer是它下面一个子扩展点"
|
|
390
|
+
}
|
|
391
|
+
],
|
|
392
|
+
"examples": [
|
|
393
|
+
{
|
|
394
|
+
"id": "drawer_basic",
|
|
395
|
+
"title": "基础用法",
|
|
396
|
+
"description": "基本的抽屉",
|
|
397
|
+
"difficulty": "easy",
|
|
398
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Drawer, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开抽屉</Button>\n <Drawer v-model=\"visible\" title=\"抽屉标题\">\n <p>抽屉内容</p>\n </Drawer>\n</template>",
|
|
399
|
+
"tags": [
|
|
400
|
+
"basic"
|
|
401
|
+
],
|
|
402
|
+
"usedProps": [
|
|
403
|
+
"value",
|
|
404
|
+
"title"
|
|
405
|
+
],
|
|
406
|
+
"usedEvents": [],
|
|
407
|
+
"usedMethods": [],
|
|
408
|
+
"scenario": "创建一个基本的抽屉"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"id": "drawer_placement",
|
|
412
|
+
"title": "不同方向",
|
|
413
|
+
"description": "从四个方向弹出的抽屉",
|
|
414
|
+
"difficulty": "easy",
|
|
415
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Drawer, Button } from '@king-design/vue';\n\nconst visible = ref(false);\nconst placement = ref<'left' | 'right' | 'top' | 'bottom'>('right');\n\nconst openDrawer = (pos: typeof placement.value) => {\n placement.value = pos;\n visible.value = true;\n};\n</script>\n<template>\n <Button @click=\"openDrawer('left')\">左侧</Button>\n <Button @click=\"openDrawer('right')\">右侧</Button>\n <Button @click=\"openDrawer('top')\">顶部</Button>\n <Button @click=\"openDrawer('bottom')\">底部</Button>\n <Drawer v-model=\"visible\" :placement=\"placement\" title=\"抽屉\">\n <p>从 {{ placement }} 方向弹出</p>\n </Drawer>\n</template>",
|
|
416
|
+
"tags": [
|
|
417
|
+
"placement",
|
|
418
|
+
"direction"
|
|
419
|
+
],
|
|
420
|
+
"usedProps": [
|
|
421
|
+
"value",
|
|
422
|
+
"placement",
|
|
423
|
+
"title"
|
|
424
|
+
],
|
|
425
|
+
"usedEvents": [],
|
|
426
|
+
"usedMethods": [],
|
|
427
|
+
"scenario": "从不同方向弹出抽屉"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"id": "drawer_width",
|
|
431
|
+
"title": "自定义宽度",
|
|
432
|
+
"description": "指定抽屉宽度",
|
|
433
|
+
"difficulty": "easy",
|
|
434
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Drawer, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开宽抽屉</Button>\n <Drawer v-model=\"visible\" title=\"宽抽屉\" :width=\"500\">\n <p>这是一个 500px 宽的抽屉</p>\n </Drawer>\n</template>",
|
|
435
|
+
"tags": [
|
|
436
|
+
"width",
|
|
437
|
+
"custom"
|
|
438
|
+
],
|
|
439
|
+
"usedProps": [
|
|
440
|
+
"value",
|
|
441
|
+
"title",
|
|
442
|
+
"width"
|
|
443
|
+
],
|
|
444
|
+
"usedEvents": [],
|
|
445
|
+
"usedMethods": [],
|
|
446
|
+
"scenario": "自定义抽屉宽度"
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"id": "drawer_footer",
|
|
450
|
+
"title": "自定义底部",
|
|
451
|
+
"description": "自定义抽屉底部按钮",
|
|
452
|
+
"difficulty": "medium",
|
|
453
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Drawer, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开抽屉</Button>\n <Drawer 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 </template>\n </Drawer>\n</template>",
|
|
454
|
+
"tags": [
|
|
455
|
+
"footer",
|
|
456
|
+
"slot",
|
|
457
|
+
"custom"
|
|
458
|
+
],
|
|
459
|
+
"usedProps": [
|
|
460
|
+
"value",
|
|
461
|
+
"title"
|
|
462
|
+
],
|
|
463
|
+
"usedEvents": [],
|
|
464
|
+
"usedSlots": [
|
|
465
|
+
"footer"
|
|
466
|
+
],
|
|
467
|
+
"usedMethods": [],
|
|
468
|
+
"scenario": "自定义抽屉底部按钮区域"
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"id": "drawer_no_overlay",
|
|
472
|
+
"title": "无遮罩层",
|
|
473
|
+
"description": "隐藏遮罩层的抽屉",
|
|
474
|
+
"difficulty": "easy",
|
|
475
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Drawer, Button } from '@king-design/vue';\n\nconst visible = ref(false);\n</script>\n<template>\n <Button @click=\"visible = true\">打开无遮罩抽屉</Button>\n <Drawer v-model=\"visible\" title=\"无遮罩\" :overlay=\"false\">\n <p>没有遮罩层的抽屉</p>\n </Drawer>\n</template>",
|
|
476
|
+
"tags": [
|
|
477
|
+
"overlay",
|
|
478
|
+
"no-mask"
|
|
479
|
+
],
|
|
480
|
+
"usedProps": [
|
|
481
|
+
"value",
|
|
482
|
+
"title",
|
|
483
|
+
"overlay"
|
|
484
|
+
],
|
|
485
|
+
"usedEvents": [],
|
|
486
|
+
"usedMethods": [],
|
|
487
|
+
"scenario": "创建无遮罩层的抽屉"
|
|
488
|
+
},
|
|
489
|
+
{
|
|
490
|
+
"id": "drawer_form",
|
|
491
|
+
"title": "抽屉表单",
|
|
492
|
+
"description": "在抽屉中放置表单",
|
|
493
|
+
"difficulty": "medium",
|
|
494
|
+
"code": "<script setup lang=\"ts\">\nimport { ref, reactive } from 'vue';\nimport { Drawer, Button, Form, FormItem, Input } from '@king-design/vue';\n\nconst visible = ref(false);\nconst loading = ref(false);\nconst form = reactive({\n name: '',\n email: ''\n});\n\nconst handleOk = async () => {\n loading.value = true;\n // 模拟提交\n await new Promise(r => setTimeout(r, 1000));\n loading.value = false;\n visible.value = false;\n};\n</script>\n<template>\n <Button @click=\"visible = true\">打开表单</Button>\n <Drawer v-model=\"visible\" title=\"编辑信息\" :loading=\"loading\" @ok=\"handleOk\">\n <Form>\n <FormItem label=\"姓名\">\n <Input v-model=\"form.name\" />\n </FormItem>\n <FormItem label=\"邮箱\">\n <Input v-model=\"form.email\" />\n </FormItem>\n </Form>\n </Drawer>\n</template>",
|
|
495
|
+
"tags": [
|
|
496
|
+
"form",
|
|
497
|
+
"submit",
|
|
498
|
+
"loading"
|
|
499
|
+
],
|
|
500
|
+
"usedProps": [
|
|
501
|
+
"value",
|
|
502
|
+
"title",
|
|
503
|
+
"loading"
|
|
504
|
+
],
|
|
505
|
+
"usedEvents": [
|
|
506
|
+
"ok"
|
|
507
|
+
],
|
|
508
|
+
"usedMethods": [],
|
|
509
|
+
"scenario": "在抽屉中放置编辑表单"
|
|
510
|
+
}
|
|
511
|
+
],
|
|
512
|
+
"commonMistakes": [
|
|
513
|
+
{
|
|
514
|
+
"id": "drawer_placement_typo",
|
|
515
|
+
"description": "placement 值拼写错误",
|
|
516
|
+
"wrongCode": "<Drawer placement=\"center\">",
|
|
517
|
+
"correctCode": "<Drawer placement=\"right\">",
|
|
518
|
+
"explanation": "placement 只支持 top, bottom, left, right,不存在 center 值",
|
|
519
|
+
"relatedProps": [
|
|
520
|
+
"placement"
|
|
521
|
+
]
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"id": "drawer_vmodel_name",
|
|
525
|
+
"description": "使用错误的 v-model 属性名",
|
|
526
|
+
"wrongCode": "<Drawer v-model:visible=\"visible\">",
|
|
527
|
+
"correctCode": "<Drawer v-model=\"visible\">",
|
|
528
|
+
"explanation": "Drawer 使用 v-model 控制显示状态,不是 v-model:visible",
|
|
529
|
+
"relatedProps": [
|
|
530
|
+
"value"
|
|
531
|
+
]
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"id": "drawer_closable_vs_hideclose",
|
|
535
|
+
"description": "混淆 closable 和 hideClose",
|
|
536
|
+
"wrongCode": "<Drawer :closable=\"true\"> <!-- 想隐藏关闭按钮 -->",
|
|
537
|
+
"correctCode": "<Drawer hideClose> <!-- 隐藏关闭按钮 -->\n<Drawer :closable=\"false\"> <!-- 禁止点击遮罩关闭 -->",
|
|
538
|
+
"explanation": "closable 控制点击遮罩是否关闭,hideClose 控制是否显示关闭按钮",
|
|
539
|
+
"relatedProps": [
|
|
540
|
+
"closable",
|
|
541
|
+
"hideClose"
|
|
542
|
+
]
|
|
543
|
+
}
|
|
544
|
+
],
|
|
545
|
+
"searchKeywords": [
|
|
546
|
+
"抽屉",
|
|
547
|
+
"drawer",
|
|
548
|
+
"侧边栏",
|
|
549
|
+
"滑出",
|
|
550
|
+
"面板",
|
|
551
|
+
"详情"
|
|
552
|
+
],
|
|
553
|
+
"useCases": [
|
|
554
|
+
"详情信息展示",
|
|
555
|
+
"表单编辑面板",
|
|
556
|
+
"配置设置面板",
|
|
557
|
+
"多级菜单操作",
|
|
558
|
+
"预览查看面板"
|
|
559
|
+
],
|
|
560
|
+
"relatedComponents": [
|
|
561
|
+
"Dialog"
|
|
562
|
+
]
|
|
563
|
+
}
|