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,207 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "carousel",
|
|
3
|
+
"name": "Carousel",
|
|
4
|
+
"displayName": "走马灯",
|
|
5
|
+
"category": "data",
|
|
6
|
+
"description": "走马灯/轮播图组件,循环播放一组图片、文字或自定义内容。支持自动播放、切换效果、自定义箭头等功能。",
|
|
7
|
+
"importStatement": "import { Carousel, CarouselItem } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "value",
|
|
11
|
+
"description": "当前展示的内容块对应的值。默认为索引字符串 \"$0\", \"$1\" 等",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "string",
|
|
14
|
+
"kind": "string"
|
|
15
|
+
},
|
|
16
|
+
"required": false,
|
|
17
|
+
"default": "\"$0\"",
|
|
18
|
+
"usageExample": "<Carousel v-model=\"currentValue\">"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "autoplay",
|
|
22
|
+
"description": "是否自动切换。如果传入数字,则表示自动切换的时间间隔(毫秒)。为 0 或 false 则不自动切换。",
|
|
23
|
+
"type": {
|
|
24
|
+
"raw": "boolean | number",
|
|
25
|
+
"kind": "union"
|
|
26
|
+
},
|
|
27
|
+
"required": false,
|
|
28
|
+
"default": "false",
|
|
29
|
+
"usageExample": "<Carousel :autoplay=\"3000\">"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "arrow",
|
|
33
|
+
"description": "左右切换箭头的展示方式",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "\"hover\" | \"always\" | \"never\"",
|
|
36
|
+
"kind": "union",
|
|
37
|
+
"unionTypes": [
|
|
38
|
+
"hover",
|
|
39
|
+
"always",
|
|
40
|
+
"never"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
"required": false,
|
|
44
|
+
"default": "\"hover\"",
|
|
45
|
+
"allowedValues": [
|
|
46
|
+
{
|
|
47
|
+
"value": "hover",
|
|
48
|
+
"label": "鼠标悬停时显示",
|
|
49
|
+
"isDefault": true
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"value": "always",
|
|
53
|
+
"label": "始终显示"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"value": "never",
|
|
57
|
+
"label": "不显示"
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
"usageExample": "<Carousel arrow=\"always\">"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "effect",
|
|
64
|
+
"description": "切换动画效果",
|
|
65
|
+
"type": {
|
|
66
|
+
"raw": "\"slide\" | \"fade\"",
|
|
67
|
+
"kind": "union",
|
|
68
|
+
"unionTypes": [
|
|
69
|
+
"slide",
|
|
70
|
+
"fade"
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
"required": false,
|
|
74
|
+
"default": "\"slide\"",
|
|
75
|
+
"allowedValues": [
|
|
76
|
+
{
|
|
77
|
+
"value": "slide",
|
|
78
|
+
"label": "滑动切换",
|
|
79
|
+
"isDefault": true
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"value": "fade",
|
|
83
|
+
"label": "淡入淡出"
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"usageExample": "<Carousel effect=\"fade\">"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "clonedAmount",
|
|
90
|
+
"description": "slide 模式下,指定前后克隆的内容块数量,用于无缝循环轮播",
|
|
91
|
+
"type": {
|
|
92
|
+
"raw": "number",
|
|
93
|
+
"kind": "number"
|
|
94
|
+
},
|
|
95
|
+
"required": false,
|
|
96
|
+
"default": "1",
|
|
97
|
+
"usageExample": "<Carousel :clonedAmount=\"2\">"
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
"events": [],
|
|
101
|
+
"methods": [],
|
|
102
|
+
"subComponents": [
|
|
103
|
+
{
|
|
104
|
+
"name": "CarouselItem",
|
|
105
|
+
"description": "走马灯的内容项",
|
|
106
|
+
"props": [
|
|
107
|
+
{
|
|
108
|
+
"name": "value",
|
|
109
|
+
"description": "定义该项的唯一值,若不设置默认为索引 \"$0\", \"$1\"...",
|
|
110
|
+
"type": {
|
|
111
|
+
"raw": "string",
|
|
112
|
+
"kind": "string"
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"default": "undefined",
|
|
116
|
+
"usageExample": "<CarouselItem value=\"item1\">"
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
"examples": [
|
|
122
|
+
{
|
|
123
|
+
"id": "carousel_basic",
|
|
124
|
+
"title": "基础用法",
|
|
125
|
+
"description": "基本的走马灯效果",
|
|
126
|
+
"difficulty": "easy",
|
|
127
|
+
"code": "<script setup lang=\"ts\">\nimport { Carousel, CarouselItem } from '@king-design/vue';\n</script>\n<template>\n <Carousel style=\"height: 200px;\">\n <CarouselItem>\n <div class=\"demo-item\">1</div>\n </CarouselItem>\n <CarouselItem>\n <div class=\"demo-item\">2</div>\n </CarouselItem>\n <CarouselItem>\n <div class=\"demo-item\">3</div>\n </CarouselItem>\n </Carousel>\n</template>\n<style>\n.demo-item {\n height: 100%;\n background: #36cfc9;\n display: flex;\n align-items: center;\n justify-content: center;\n color: #fff;\n font-size: 20px;\n}\n</style>",
|
|
128
|
+
"tags": [
|
|
129
|
+
"basic",
|
|
130
|
+
"slide"
|
|
131
|
+
],
|
|
132
|
+
"usedProps": [],
|
|
133
|
+
"usedEvents": [],
|
|
134
|
+
"usedSlots": [
|
|
135
|
+
"default"
|
|
136
|
+
],
|
|
137
|
+
"usedMethods": [],
|
|
138
|
+
"scenario": "基本的轮播展示"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"id": "carousel_autoplay",
|
|
142
|
+
"title": "自动轮播",
|
|
143
|
+
"description": "设置 autoplay 属性自动播放",
|
|
144
|
+
"difficulty": "easy",
|
|
145
|
+
"code": "<script setup lang=\"ts\">\nimport { Carousel, CarouselItem } from '@king-design/vue';\n</script>\n<template>\n <Carousel :autoplay=\"3000\" style=\"height: 200px;\">\n <CarouselItem>Page 1</CarouselItem>\n <CarouselItem>Page 2</CarouselItem>\n </Carousel>\n</template>",
|
|
146
|
+
"tags": [
|
|
147
|
+
"autoplay",
|
|
148
|
+
"timer"
|
|
149
|
+
],
|
|
150
|
+
"usedProps": [
|
|
151
|
+
"autoplay"
|
|
152
|
+
],
|
|
153
|
+
"usedEvents": [],
|
|
154
|
+
"usedSlots": [
|
|
155
|
+
"default"
|
|
156
|
+
],
|
|
157
|
+
"usedMethods": [],
|
|
158
|
+
"scenario": "首页 Banner 自动轮播"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "carousel_fade",
|
|
162
|
+
"title": "淡入淡出",
|
|
163
|
+
"description": "使用 effect=\"fade\" 切换效果",
|
|
164
|
+
"difficulty": "easy",
|
|
165
|
+
"code": "<script setup lang=\"ts\">\nimport { Carousel, CarouselItem } from '@king-design/vue';\n</script>\n<template>\n <Carousel effect=\"fade\" style=\"height: 200px;\">\n <CarouselItem>Page 1</CarouselItem>\n <CarouselItem>Page 2</CarouselItem>\n </Carousel>\n</template>",
|
|
166
|
+
"tags": [
|
|
167
|
+
"fade",
|
|
168
|
+
"effect"
|
|
169
|
+
],
|
|
170
|
+
"usedProps": [
|
|
171
|
+
"effect"
|
|
172
|
+
],
|
|
173
|
+
"usedEvents": [],
|
|
174
|
+
"usedSlots": [
|
|
175
|
+
"default"
|
|
176
|
+
],
|
|
177
|
+
"usedMethods": [],
|
|
178
|
+
"scenario": "使用淡入淡出效果的轮播"
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
"commonMistakes": [
|
|
182
|
+
{
|
|
183
|
+
"id": "carousel_height",
|
|
184
|
+
"description": "未设置 Carousel 高度",
|
|
185
|
+
"wrongCode": "<Carousel>...</Carousel>",
|
|
186
|
+
"correctCode": "<Carousel style=\"height: 300px;\">...</Carousel>",
|
|
187
|
+
"explanation": "Carousel 默认可能没有高度或者高度为 0,需要显式设置高度。",
|
|
188
|
+
"relatedProps": []
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
"searchKeywords": [
|
|
192
|
+
"走马灯",
|
|
193
|
+
"carousel",
|
|
194
|
+
"slider",
|
|
195
|
+
"轮播",
|
|
196
|
+
"banner",
|
|
197
|
+
"swiper",
|
|
198
|
+
"slide"
|
|
199
|
+
],
|
|
200
|
+
"useCases": [
|
|
201
|
+
"首页 Banner 展示",
|
|
202
|
+
"图片画廊",
|
|
203
|
+
"产品特性轮播介绍",
|
|
204
|
+
"公告通知轮播"
|
|
205
|
+
],
|
|
206
|
+
"relatedComponents": []
|
|
207
|
+
}
|
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "cascader",
|
|
3
|
+
"name": "Cascader",
|
|
4
|
+
"displayName": "级联选择",
|
|
5
|
+
"category": "form",
|
|
6
|
+
"description": "级联选择框。用于多层级数据的选择,如省市区选择、公司层级选择等。",
|
|
7
|
+
"importStatement": "import { Cascader } from '@king-design/vue';",
|
|
8
|
+
"props": [
|
|
9
|
+
{
|
|
10
|
+
"name": "value",
|
|
11
|
+
"description": "当前选中的值。多选模式下为数组。",
|
|
12
|
+
"type": {
|
|
13
|
+
"raw": "any",
|
|
14
|
+
"kind": "custom"
|
|
15
|
+
},
|
|
16
|
+
"required": false,
|
|
17
|
+
"default": "\"\"",
|
|
18
|
+
"usageExample": "<Cascader v-model=\"selectedCity\">"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "data",
|
|
22
|
+
"description": "级联数据源。结构为 {value, label, children}[]",
|
|
23
|
+
"type": {
|
|
24
|
+
"raw": "CascaderData[]",
|
|
25
|
+
"kind": "array"
|
|
26
|
+
},
|
|
27
|
+
"required": true,
|
|
28
|
+
"default": "[]",
|
|
29
|
+
"usageExample": "<Cascader :data=\"options\">"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "multiple",
|
|
33
|
+
"description": "是否开启多选模式",
|
|
34
|
+
"type": {
|
|
35
|
+
"raw": "boolean",
|
|
36
|
+
"kind": "boolean"
|
|
37
|
+
},
|
|
38
|
+
"required": false,
|
|
39
|
+
"default": "false",
|
|
40
|
+
"usageExample": "<Cascader multiple>"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "filterable",
|
|
44
|
+
"description": "是否可搜索",
|
|
45
|
+
"type": {
|
|
46
|
+
"raw": "boolean",
|
|
47
|
+
"kind": "boolean"
|
|
48
|
+
},
|
|
49
|
+
"required": false,
|
|
50
|
+
"default": "false",
|
|
51
|
+
"usageExample": "<Cascader filterable>"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "clearable",
|
|
55
|
+
"description": "是否显示清空按钮",
|
|
56
|
+
"type": {
|
|
57
|
+
"raw": "boolean",
|
|
58
|
+
"kind": "boolean"
|
|
59
|
+
},
|
|
60
|
+
"required": false,
|
|
61
|
+
"default": "false",
|
|
62
|
+
"usageExample": "<Cascader clearable>"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "disabled",
|
|
66
|
+
"description": "是否禁用",
|
|
67
|
+
"type": {
|
|
68
|
+
"raw": "boolean",
|
|
69
|
+
"kind": "boolean"
|
|
70
|
+
},
|
|
71
|
+
"required": false,
|
|
72
|
+
"default": "false",
|
|
73
|
+
"usageExample": "<Cascader disabled>"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "size",
|
|
77
|
+
"description": "尺寸",
|
|
78
|
+
"type": {
|
|
79
|
+
"raw": "\"large\" | \"default\" | \"small\" | \"mini\"",
|
|
80
|
+
"kind": "union",
|
|
81
|
+
"unionTypes": [
|
|
82
|
+
"large",
|
|
83
|
+
"default",
|
|
84
|
+
"small",
|
|
85
|
+
"mini"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"required": false,
|
|
89
|
+
"default": "\"default\"",
|
|
90
|
+
"allowedValues": [
|
|
91
|
+
{
|
|
92
|
+
"value": "large",
|
|
93
|
+
"label": "大尺寸"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"value": "default",
|
|
97
|
+
"label": "默认尺寸",
|
|
98
|
+
"isDefault": true
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"value": "small",
|
|
102
|
+
"label": "小尺寸"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"value": "mini",
|
|
106
|
+
"label": "迷你尺寸"
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"usageExample": "<Cascader size=\"small\">"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "trigger",
|
|
113
|
+
"description": "子菜单触发方式",
|
|
114
|
+
"type": {
|
|
115
|
+
"raw": "\"click\" | \"hover\"",
|
|
116
|
+
"kind": "union",
|
|
117
|
+
"unionTypes": [
|
|
118
|
+
"click",
|
|
119
|
+
"hover"
|
|
120
|
+
]
|
|
121
|
+
},
|
|
122
|
+
"required": false,
|
|
123
|
+
"default": "\"click\"",
|
|
124
|
+
"allowedValues": [
|
|
125
|
+
{
|
|
126
|
+
"value": "click",
|
|
127
|
+
"label": "点击触发",
|
|
128
|
+
"isDefault": true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"value": "hover",
|
|
132
|
+
"label": "悬停触发"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"usageExample": "<Cascader trigger=\"hover\">"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "changeOnSelect",
|
|
139
|
+
"description": "是否选中父级即改变 value(允许选择任意一级)",
|
|
140
|
+
"type": {
|
|
141
|
+
"raw": "boolean",
|
|
142
|
+
"kind": "boolean"
|
|
143
|
+
},
|
|
144
|
+
"required": false,
|
|
145
|
+
"default": "false",
|
|
146
|
+
"usageExample": "<Cascader changeOnSelect>"
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
"name": "format",
|
|
150
|
+
"description": "自定义选中项的显示格式,参数为选中的数据项数组,返回显示的字符串。",
|
|
151
|
+
"type": {
|
|
152
|
+
"raw": "(values: any[]) => string",
|
|
153
|
+
"kind": "function"
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"default": "undefined",
|
|
157
|
+
"usageExample": "<Cascader :format=\"(v) => v.map(i => i.label).join(' > ')\">"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"name": "loadData",
|
|
161
|
+
"description": "动态加载数据函数。当子节点为空时调用。",
|
|
162
|
+
"type": {
|
|
163
|
+
"raw": "(item: any) => Promise<void> | void",
|
|
164
|
+
"kind": "function"
|
|
165
|
+
},
|
|
166
|
+
"required": false,
|
|
167
|
+
"default": "undefined",
|
|
168
|
+
"usageExample": "<Cascader :loadData=\"loadMore\">"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "loading",
|
|
172
|
+
"description": "是否显示加载中状态",
|
|
173
|
+
"type": {
|
|
174
|
+
"raw": "boolean",
|
|
175
|
+
"kind": "boolean"
|
|
176
|
+
},
|
|
177
|
+
"required": false,
|
|
178
|
+
"default": "false",
|
|
179
|
+
"usageExample": "<Cascader loading>"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "placeholder",
|
|
183
|
+
"description": "占位文本",
|
|
184
|
+
"type": {
|
|
185
|
+
"raw": "string",
|
|
186
|
+
"kind": "string"
|
|
187
|
+
},
|
|
188
|
+
"required": false,
|
|
189
|
+
"default": "\"请选择\"",
|
|
190
|
+
"usageExample": "<Cascader placeholder=\"请选择城市\">"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "fields",
|
|
194
|
+
"description": "自定义字段名映射,默认 {value:'value', label:'label', children:'children', disabled:'disabled'}",
|
|
195
|
+
"type": {
|
|
196
|
+
"raw": "object",
|
|
197
|
+
"kind": "custom"
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"default": "undefined",
|
|
201
|
+
"usageExample": "<Cascader :fields=\"{value: 'code', label: 'name'}\">"
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"events": [
|
|
205
|
+
{
|
|
206
|
+
"name": "change",
|
|
207
|
+
"description": "值发生变化时触发",
|
|
208
|
+
"params": [
|
|
209
|
+
{
|
|
210
|
+
"name": "value",
|
|
211
|
+
"type": "any",
|
|
212
|
+
"description": "当前选中的值"
|
|
213
|
+
}
|
|
214
|
+
],
|
|
215
|
+
"usageExample": "<Cascader @change=\"handleChange\">"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"name": "show",
|
|
219
|
+
"description": "菜单显示时触发",
|
|
220
|
+
"params": [],
|
|
221
|
+
"usageExample": "<Cascader @show=\"onShow\">"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
"name": "hide",
|
|
225
|
+
"description": "菜单隐藏时触发",
|
|
226
|
+
"params": [],
|
|
227
|
+
"usageExample": "<Cascader @hide=\"onHide\">"
|
|
228
|
+
}
|
|
229
|
+
],
|
|
230
|
+
"slots": [
|
|
231
|
+
{
|
|
232
|
+
"name": "value",
|
|
233
|
+
"description": "自定义选择结果的展示",
|
|
234
|
+
"params": "([value: any, label: Children]) => Children"
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "values",
|
|
238
|
+
"description": "自定义多选的选择结果的展示",
|
|
239
|
+
"params": "([values: any[], labels: Children[]]) => Children"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"name": "prefix",
|
|
243
|
+
"description": "自定义输入框前面展示的内容"
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "suffix",
|
|
247
|
+
"description": "自定义输入框后面展示的内容"
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
"methods": [],
|
|
251
|
+
"typeDefinitions": [
|
|
252
|
+
{
|
|
253
|
+
"name": "CascaderData",
|
|
254
|
+
"definition": "interface CascaderData {\n value: string | number;\n label: string;\n children?: CascaderData[];\n disabled?: boolean;\n loaded?: boolean;\n [key: string]: any;\n}",
|
|
255
|
+
"description": "级联选择器数据项结构"
|
|
256
|
+
}
|
|
257
|
+
],
|
|
258
|
+
"examples": [
|
|
259
|
+
{
|
|
260
|
+
"id": "cascader_basic",
|
|
261
|
+
"title": "基础用法",
|
|
262
|
+
"description": "省市区级联选择",
|
|
263
|
+
"difficulty": "easy",
|
|
264
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Cascader } from '@king-design/vue';\n\nconst value = ref([]);\nconst options = [\n {\n value: 'zhejiang',\n label: 'Zhejiang',\n children: [\n {\n value: 'hangzhou',\n label: 'Hangzhou',\n children: [\n {\n value: 'xihu',\n label: 'West Lake',\n },\n ],\n },\n ],\n },\n {\n value: 'jiangsu',\n label: 'Jiangsu',\n children: [\n {\n value: 'nanjing',\n label: 'Nanjing',\n children: [\n {\n value: 'zhonghuamen',\n label: 'Zhong Hua Men',\n },\n ],\n },\n ],\n },\n];\n</script>\n<template>\n <Cascader v-model=\"value\" :data=\"options\" />\n</template>",
|
|
265
|
+
"tags": [
|
|
266
|
+
"basic",
|
|
267
|
+
"select"
|
|
268
|
+
],
|
|
269
|
+
"usedProps": [
|
|
270
|
+
"data",
|
|
271
|
+
"value"
|
|
272
|
+
],
|
|
273
|
+
"usedEvents": [],
|
|
274
|
+
"usedSlots": [],
|
|
275
|
+
"usedMethods": [],
|
|
276
|
+
"scenario": "选择地理位置"
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"id": "cascader_display_input",
|
|
280
|
+
"title": "显示在输入框",
|
|
281
|
+
"description": "显示完整的选择路径",
|
|
282
|
+
"difficulty": "easy",
|
|
283
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Cascader } from '@king-design/vue';\n\nconst value = ref([]);\nconst options = [{ value: 'bj', label: 'Beijing', children: [{ value: 'hd', label: 'Haidian' }] }];\n</script>\n<template>\n <Cascader v-model=\"value\" :data=\"options\" placeholder=\"请选择\" />\n</template>",
|
|
284
|
+
"tags": [
|
|
285
|
+
"input",
|
|
286
|
+
"placeholder"
|
|
287
|
+
],
|
|
288
|
+
"usedProps": [
|
|
289
|
+
"placeholder"
|
|
290
|
+
],
|
|
291
|
+
"usedEvents": [],
|
|
292
|
+
"usedSlots": [],
|
|
293
|
+
"usedMethods": [],
|
|
294
|
+
"scenario": "表单中的级联选择"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
"id": "cascader_change_on_select",
|
|
298
|
+
"title": "选择即改变",
|
|
299
|
+
"description": "允许选择任意一级菜单",
|
|
300
|
+
"difficulty": "medium",
|
|
301
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Cascader } from '@king-design/vue';\n\nconst value = ref([]);\nconst options = [{ value: 'bj', label: 'Beijing', children: [{ value: 'hd', label: 'Haidian' }] }];\n</script>\n<template>\n <Cascader v-model=\"value\" :data=\"options\" changeOnSelect />\n</template>",
|
|
302
|
+
"tags": [
|
|
303
|
+
"flexible",
|
|
304
|
+
"changeOnSelect"
|
|
305
|
+
],
|
|
306
|
+
"usedProps": [
|
|
307
|
+
"changeOnSelect"
|
|
308
|
+
],
|
|
309
|
+
"usedEvents": [],
|
|
310
|
+
"usedSlots": [],
|
|
311
|
+
"usedMethods": [],
|
|
312
|
+
"scenario": "可以只选择省份,也可以选择到城市"
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
"id": "cascader_multiple",
|
|
316
|
+
"title": "多选模式",
|
|
317
|
+
"description": "支持多选",
|
|
318
|
+
"difficulty": "medium",
|
|
319
|
+
"code": "<script setup lang=\"ts\">\nimport { ref } from 'vue';\nimport { Cascader } from '@king-design/vue';\n\nconst value = ref([]);\nconst options = [\n { value: '1', label: 'Option 1', children: [{ value: '1-1', label: 'Option 1-1' }] },\n { value: '2', label: 'Option 2', children: [{ value: '2-1', label: 'Option 2-1' }] }\n];\n</script>\n<template>\n <Cascader v-model=\"value\" :data=\"options\" multiple />\n</template>",
|
|
320
|
+
"tags": [
|
|
321
|
+
"multiple",
|
|
322
|
+
"select"
|
|
323
|
+
],
|
|
324
|
+
"usedProps": [
|
|
325
|
+
"multiple"
|
|
326
|
+
],
|
|
327
|
+
"usedEvents": [],
|
|
328
|
+
"usedSlots": [],
|
|
329
|
+
"usedMethods": [],
|
|
330
|
+
"scenario": "多选分类标签"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"commonMistakes": [
|
|
334
|
+
{
|
|
335
|
+
"id": "cascader_data_empty",
|
|
336
|
+
"description": "数据未加载时显示空白",
|
|
337
|
+
"wrongCode": "<Cascader :data=\"[]\" />",
|
|
338
|
+
"correctCode": "<Cascader :data=\"options\" :loading=\"isLoading\" />",
|
|
339
|
+
"explanation": "如果数据为空,建议设置 loading 状态或者提供数据源。",
|
|
340
|
+
"relatedProps": [
|
|
341
|
+
"data",
|
|
342
|
+
"loading"
|
|
343
|
+
]
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
"id": "cascader_value_array",
|
|
347
|
+
"description": "value 格式错误",
|
|
348
|
+
"wrongCode": "const value = ref('beijing')",
|
|
349
|
+
"correctCode": "const value = ref(['beijing', 'chaoyang'])",
|
|
350
|
+
"explanation": "Cascader 的 value 通常是一个数组(表示路径),如果是多选则为二维数组。",
|
|
351
|
+
"relatedProps": [
|
|
352
|
+
"value"
|
|
353
|
+
]
|
|
354
|
+
}
|
|
355
|
+
],
|
|
356
|
+
"searchKeywords": [
|
|
357
|
+
"级联选择",
|
|
358
|
+
"cascader",
|
|
359
|
+
"select",
|
|
360
|
+
"tree",
|
|
361
|
+
"多级联动",
|
|
362
|
+
"省市区"
|
|
363
|
+
],
|
|
364
|
+
"useCases": [
|
|
365
|
+
"省市区地址选择",
|
|
366
|
+
"公司组织架构选择",
|
|
367
|
+
"多级商品分类选择"
|
|
368
|
+
],
|
|
369
|
+
"relatedComponents": [
|
|
370
|
+
"Select",
|
|
371
|
+
"TreeSelect"
|
|
372
|
+
]
|
|
373
|
+
}
|