pit-docs-mcp 1.0.2

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.
Files changed (203) hide show
  1. package/README.md +180 -0
  2. package/dist/codegen.d.ts +5 -0
  3. package/dist/codegen.d.ts.map +1 -0
  4. package/dist/codegen.js +112 -0
  5. package/dist/constants.d.ts +6 -0
  6. package/dist/constants.d.ts.map +1 -0
  7. package/dist/constants.js +10 -0
  8. package/dist/index.d.ts +3 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +115 -0
  11. package/dist/resources.d.ts +3 -0
  12. package/dist/resources.d.ts.map +1 -0
  13. package/dist/resources.js +80 -0
  14. package/dist/tools.d.ts +3 -0
  15. package/dist/tools.d.ts.map +1 -0
  16. package/dist/tools.js +258 -0
  17. package/dist/utils.d.ts +26 -0
  18. package/dist/utils.d.ts.map +1 -0
  19. package/dist/utils.js +198 -0
  20. package/docs/codegen/pit-simplify-web.md +686 -0
  21. package/docs/pitBusinessUi/README.md +102 -0
  22. package/docs/pitBusinessUi/add-date-picker.md +57 -0
  23. package/docs/pitBusinessUi/add-operation.md +64 -0
  24. package/docs/pitBusinessUi/batch-download.md +44 -0
  25. package/docs/pitBusinessUi/bill-tree-dialog.md +82 -0
  26. package/docs/pitBusinessUi/collapse.md +88 -0
  27. package/docs/pitBusinessUi/date-time-picker.md +74 -0
  28. package/docs/pitBusinessUi/design-report-explain.md +47 -0
  29. package/docs/pitBusinessUi/dialog.md +89 -0
  30. package/docs/pitBusinessUi/dic-radio.md +67 -0
  31. package/docs/pitBusinessUi/dic.md +78 -0
  32. package/docs/pitBusinessUi/document-preview.md +54 -0
  33. package/docs/pitBusinessUi/drawer.md +67 -0
  34. package/docs/pitBusinessUi/editor.md +63 -0
  35. package/docs/pitBusinessUi/expand-search-form.md +65 -0
  36. package/docs/pitBusinessUi/file-preview.md +56 -0
  37. package/docs/pitBusinessUi/flow-table-status.md +47 -0
  38. package/docs/pitBusinessUi/icon-box.md +74 -0
  39. package/docs/pitBusinessUi/image-preview.md +55 -0
  40. package/docs/pitBusinessUi/image.md +53 -0
  41. package/docs/pitBusinessUi/input-formatter.md +100 -0
  42. package/docs/pitBusinessUi/input-number.md +47 -0
  43. package/docs/pitBusinessUi/input-select.md +68 -0
  44. package/docs/pitBusinessUi/input.md +56 -0
  45. package/docs/pitBusinessUi/jm-preview.md +47 -0
  46. package/docs/pitBusinessUi/json-editor.md +71 -0
  47. package/docs/pitBusinessUi/loading-btn.md +64 -0
  48. package/docs/pitBusinessUi/monaco.md +82 -0
  49. package/docs/pitBusinessUi/money-input.md +59 -0
  50. package/docs/pitBusinessUi/pagination.md +70 -0
  51. package/docs/pitBusinessUi/password-strength.md +59 -0
  52. package/docs/pitBusinessUi/positive-number.md +63 -0
  53. package/docs/pitBusinessUi/preview-image.md +62 -0
  54. package/docs/pitBusinessUi/preview-office.md +50 -0
  55. package/docs/pitBusinessUi/preview.md +57 -0
  56. package/docs/pitBusinessUi/quill.md +52 -0
  57. package/docs/pitBusinessUi/runflow-btn.md +52 -0
  58. package/docs/pitBusinessUi/search-date-picker.md +60 -0
  59. package/docs/pitBusinessUi/select-bid-list.md +66 -0
  60. package/docs/pitBusinessUi/select-color.md +38 -0
  61. package/docs/pitBusinessUi/select-contract-tree.md +41 -0
  62. package/docs/pitBusinessUi/select-dept.md +38 -0
  63. package/docs/pitBusinessUi/select-project-unit.md +48 -0
  64. package/docs/pitBusinessUi/select-section-tree.md +45 -0
  65. package/docs/pitBusinessUi/select-section.md +66 -0
  66. package/docs/pitBusinessUi/select-string.md +60 -0
  67. package/docs/pitBusinessUi/select-system-unit.md +41 -0
  68. package/docs/pitBusinessUi/select-user-by-role.md +51 -0
  69. package/docs/pitBusinessUi/switch.md +43 -0
  70. package/docs/pitBusinessUi/table-contract.md +66 -0
  71. package/docs/pitBusinessUi/table-operation.md +81 -0
  72. package/docs/pitBusinessUi/table.md +75 -0
  73. package/docs/pitBusinessUi/tag.md +86 -0
  74. package/docs/pitBusinessUi/textarea.md +65 -0
  75. package/docs/pitBusinessUi/transfer-direct.md +57 -0
  76. package/docs/pitBusinessUi/transfer-user-project.md +78 -0
  77. package/docs/pitBusinessUi/transfer.md +68 -0
  78. package/docs/pitBusinessUi/tree-lazy.md +72 -0
  79. package/docs/pitBusinessUi/tree-select-name.md +59 -0
  80. package/docs/pitBusinessUi/tree-select-plus.md +106 -0
  81. package/docs/pitBusinessUi/tree-select.md +86 -0
  82. package/docs/pitBusinessUi/upload-avatar.md +60 -0
  83. package/docs/pitBusinessUi/upload-file-dialog.md +86 -0
  84. package/docs/pitBusinessUi/upload-file.md +77 -0
  85. package/docs/pitBusinessUi/upload-list-card.md +62 -0
  86. package/docs/pitBusinessUi/upload-table.md +77 -0
  87. package/docs/pitBusinessUi/user-transform.md +72 -0
  88. package/docs/pitBusinessUi/utils.md +272 -0
  89. package/docs/pitBusinessUtils/README.md +144 -0
  90. package/docs/pitBusinessUtils/auth.md +170 -0
  91. package/docs/pitBusinessUtils/clipboard.md +72 -0
  92. package/docs/pitBusinessUtils/filePreview.md +60 -0
  93. package/docs/pitBusinessUtils/formValidate.md +75 -0
  94. package/docs/pitBusinessUtils/generateTitle.md +49 -0
  95. package/docs/pitBusinessUtils/get-page-title.md +65 -0
  96. package/docs/pitBusinessUtils/i18n.md +130 -0
  97. package/docs/pitBusinessUtils/jwks.md +82 -0
  98. package/docs/pitBusinessUtils/oss.md +391 -0
  99. package/docs/pitBusinessUtils/passwordValidate.md +120 -0
  100. package/docs/pitBusinessUtils/pit.md +496 -0
  101. package/docs/pitBusinessUtils/print.md +126 -0
  102. package/docs/pitBusinessUtils/request.md +137 -0
  103. package/docs/pitBusinessUtils/scroll-to.md +68 -0
  104. package/docs/pitBusinessUtils/utils.md +762 -0
  105. package/docs/pitBusinessUtils/validate.md +224 -0
  106. package/docs/pitElementUi/alert.md +238 -0
  107. package/docs/pitElementUi/avatar.md +147 -0
  108. package/docs/pitElementUi/backtop.md +60 -0
  109. package/docs/pitElementUi/badge.md +120 -0
  110. package/docs/pitElementUi/base-tabs.md +73 -0
  111. package/docs/pitElementUi/border.md +135 -0
  112. package/docs/pitElementUi/breadcrumb.md +44 -0
  113. package/docs/pitElementUi/button.md +301 -0
  114. package/docs/pitElementUi/calendar.md +66 -0
  115. package/docs/pitElementUi/card.md +170 -0
  116. package/docs/pitElementUi/carousel.md +212 -0
  117. package/docs/pitElementUi/cascader.md +1966 -0
  118. package/docs/pitElementUi/checkbox.md +283 -0
  119. package/docs/pitElementUi/collapse.md +131 -0
  120. package/docs/pitElementUi/color-picker.md +123 -0
  121. package/docs/pitElementUi/color.md +244 -0
  122. package/docs/pitElementUi/container.md +240 -0
  123. package/docs/pitElementUi/custom-theme.md +131 -0
  124. package/docs/pitElementUi/date-picker.md +448 -0
  125. package/docs/pitElementUi/datetime-picker.md +254 -0
  126. package/docs/pitElementUi/descriptions.md +191 -0
  127. package/docs/pitElementUi/dialog-header.md +53 -0
  128. package/docs/pitElementUi/dialog.md +239 -0
  129. package/docs/pitElementUi/divider.md +61 -0
  130. package/docs/pitElementUi/drawer.md +307 -0
  131. package/docs/pitElementUi/dropdown.md +308 -0
  132. package/docs/pitElementUi/empty.md +61 -0
  133. package/docs/pitElementUi/font-family.md +90 -0
  134. package/docs/pitElementUi/form-base.md +1239 -0
  135. package/docs/pitElementUi/form-item-checkbox-group.md +48 -0
  136. package/docs/pitElementUi/form-item-date.md +60 -0
  137. package/docs/pitElementUi/form-item-dic.md +18 -0
  138. package/docs/pitElementUi/form-item-editor.md +16 -0
  139. package/docs/pitElementUi/form-item-input-money.md +19 -0
  140. package/docs/pitElementUi/form-item-input-number.md +20 -0
  141. package/docs/pitElementUi/form-item-input.md +18 -0
  142. package/docs/pitElementUi/form-item-radio-group.md +21 -0
  143. package/docs/pitElementUi/form-item-select.md +21 -0
  144. package/docs/pitElementUi/form-item-switch.md +15 -0
  145. package/docs/pitElementUi/form-item-textarea.md +20 -0
  146. package/docs/pitElementUi/form-item-tree-select.md +27 -0
  147. package/docs/pitElementUi/form-item-upload-card.md +18 -0
  148. package/docs/pitElementUi/form-item-upload.md +1 -0
  149. package/docs/pitElementUi/form-two.md +102 -0
  150. package/docs/pitElementUi/form.md +952 -0
  151. package/docs/pitElementUi/i18n.md +228 -0
  152. package/docs/pitElementUi/icon-custom.md +99 -0
  153. package/docs/pitElementUi/icon-line-custom.md +12 -0
  154. package/docs/pitElementUi/icon.md +28 -0
  155. package/docs/pitElementUi/image.md +178 -0
  156. package/docs/pitElementUi/infiniteScroll.md +87 -0
  157. package/docs/pitElementUi/input-number.md +197 -0
  158. package/docs/pitElementUi/input-select.md +1 -0
  159. package/docs/pitElementUi/input.md +800 -0
  160. package/docs/pitElementUi/installation.md +9 -0
  161. package/docs/pitElementUi/layout-column.md +376 -0
  162. package/docs/pitElementUi/layout-tree.md +715 -0
  163. package/docs/pitElementUi/layout.md +354 -0
  164. package/docs/pitElementUi/link.md +66 -0
  165. package/docs/pitElementUi/loading.md +208 -0
  166. package/docs/pitElementUi/menu.md +403 -0
  167. package/docs/pitElementUi/message-box.md +326 -0
  168. package/docs/pitElementUi/message.md +219 -0
  169. package/docs/pitElementUi/notification.md +311 -0
  170. package/docs/pitElementUi/page-header.md +40 -0
  171. package/docs/pitElementUi/pagination.md +200 -0
  172. package/docs/pitElementUi/popconfirm.md +60 -0
  173. package/docs/pitElementUi/popover.md +167 -0
  174. package/docs/pitElementUi/progress.md +178 -0
  175. package/docs/pitElementUi/quickstart.md +290 -0
  176. package/docs/pitElementUi/radio.md +211 -0
  177. package/docs/pitElementUi/rate.md +135 -0
  178. package/docs/pitElementUi/result.md +76 -0
  179. package/docs/pitElementUi/select-tree.md +661 -0
  180. package/docs/pitElementUi/select.md +586 -0
  181. package/docs/pitElementUi/skeleton.md +316 -0
  182. package/docs/pitElementUi/slider.md +237 -0
  183. package/docs/pitElementUi/steps.md +154 -0
  184. package/docs/pitElementUi/switch.md +142 -0
  185. package/docs/pitElementUi/table.md +4023 -0
  186. package/docs/pitElementUi/tabs.md +303 -0
  187. package/docs/pitElementUi/tag.md +203 -0
  188. package/docs/pitElementUi/time-picker.md +199 -0
  189. package/docs/pitElementUi/timeline.md +154 -0
  190. package/docs/pitElementUi/tooltip.md +177 -0
  191. package/docs/pitElementUi/transfer.md +249 -0
  192. package/docs/pitElementUi/transition.md +155 -0
  193. package/docs/pitElementUi/tree.md +1157 -0
  194. package/docs/pitElementUi/typography.md +151 -0
  195. package/docs/pitElementUi/upload-table.md +39 -0
  196. package/docs/pitElementUi/upload.md +392 -0
  197. package/docs/pitElementUi/virtual-list.md +154 -0
  198. package/docs/pitElementUi/virtual-select-tree.md +243 -0
  199. package/docs/pitElementUi/virtual-select.md +451 -0
  200. package/docs/pitElementUi/virtual-table-column.md +1 -0
  201. package/docs/pitElementUi/virtual-table.md +490 -0
  202. package/docs/pitElementUi/virtual-tree.md +119 -0
  203. package/package.json +33 -0
@@ -0,0 +1,66 @@
1
+ ## Calendar calendar
2
+
3
+ 显示日期
4
+
5
+ ### 基本
6
+
7
+ :::demo 设置 `value` 来指定当前显示的月份。如果 `value` 未指定,则显示当月。`value` 支持 `v-model` 双向绑定。
8
+ ```html
9
+ <el-calendar v-model="value">
10
+ </el-calendar>
11
+
12
+ <script>
13
+ export default {
14
+ data() {
15
+ return {
16
+ value: new Date()
17
+ }
18
+ }
19
+ }
20
+ </script>
21
+ ```
22
+ :::
23
+
24
+ ### 自定义内容
25
+
26
+ :::demo 通过设置名为 `dateCell` 的 `scoped-slot` 来自定义日历单元格中显示的内容。在 `scoped-slot` 可以获取到 date(当前单元格的日期), data(包括 type,isSelected,day 属性)。详情解释参考下方的 API 文档。
27
+ ```html
28
+ <el-calendar>
29
+ <!-- 这里使用的是 2.5 slot 语法,对于新项目请使用 2.6 slot 语法-->
30
+ <template
31
+ slot="dateCell"
32
+ slot-scope="{date, data}">
33
+ <p :class="data.isSelected ? 'is-selected' : ''">
34
+ {{ data.day.split('-').slice(1).join('-') }} {{ data.isSelected ? '✔️' : ''}}
35
+ </p>
36
+ </template>
37
+ </el-calendar>
38
+ <style>
39
+ .is-selected {
40
+ color: #1989FA;
41
+ }
42
+ </style>
43
+ ```
44
+ :::
45
+
46
+ ### 自定义范围
47
+
48
+ :::demo 设置 `range` 属性指定日历的显示范围。开始时间必须是周起始日,结束时间必须是周结束日,且时间跨度不能超过两个月。
49
+ ```html
50
+ <el-calendar :range="['2019-03-04', '2019-03-24']">
51
+ </el-calendar>
52
+ ```
53
+ :::
54
+
55
+ ### Attributes
56
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
57
+ |-----------------|-------------- |---------- |------------ |-------- |
58
+ | value / v-model | 绑定值 | Date/string/number | — | — |
59
+ | range | 时间范围,包括开始时间与结束时间。开始时间必须是周一,结束时间必须是周日,且时间跨度不能超过两个月。 | Array | — | — |
60
+ | first-day-of-week | 周起始日 | Number | 1 到 7 | 1 |
61
+
62
+ ### dateCell scoped slot 参数
63
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
64
+ |-----------------|-------------- |---------- |------------ |-------- |
65
+ | date | 单元格代表的日期 | Date | — | — |
66
+ | data | { type, isSelected, day},`type` 表示该日期的所属月份,可选值有 prev-month,current-month,next-month;`isSelected` 标明该日期是否被选中;`day` 是格式化的日期,格式为 yyyy-MM-dd | Object | — | — |
@@ -0,0 +1,170 @@
1
+ ## Card 卡片
2
+ 将信息聚合在卡片容器中展示。
3
+
4
+ ### 基础用法
5
+
6
+
7
+ 包含标题,内容和操作。
8
+
9
+ :::demo Card 组件包括`header`和`body`部分,`header`部分需要有显式具名 slot 分发,同时也是可选的。
10
+ ```html
11
+ <el-card class="box-card">
12
+ <div slot="header" class="clearfix">
13
+ <span>卡片名称</span>
14
+ <el-button style="float: right; padding: 3px 0" type="text">操作按钮</el-button>
15
+ </div>
16
+ <div v-for="o in 4" :key="o" class="text item">
17
+ {{'列表内容 ' + o }}
18
+ </div>
19
+ </el-card>
20
+
21
+ <style>
22
+ .text {
23
+ font-size: 14px;
24
+ }
25
+
26
+ .item {
27
+ margin-bottom: 18px;
28
+ }
29
+
30
+ .clearfix:before,
31
+ .clearfix:after {
32
+ display: table;
33
+ content: "";
34
+ }
35
+ .clearfix:after {
36
+ clear: both
37
+ }
38
+
39
+ .box-card {
40
+ width: 480px;
41
+ }
42
+ </style>
43
+ ```
44
+ :::
45
+
46
+ ### 简单卡片
47
+
48
+ 卡片可以只有内容区域。
49
+
50
+ :::demo
51
+ ```html
52
+ <el-card class="box-card">
53
+ <div v-for="o in 4" :key="o" class="text item">
54
+ {{'列表内容 ' + o }}
55
+ </div>
56
+ </el-card>
57
+
58
+ <style>
59
+ .text {
60
+ font-size: 14px;
61
+ }
62
+
63
+ .item {
64
+ padding: 18px 0;
65
+ }
66
+
67
+ .box-card {
68
+ width: 480px;
69
+ }
70
+ </style>
71
+ ```
72
+ :::
73
+
74
+ ### 带图片
75
+
76
+ 可配置定义更丰富的内容展示。
77
+
78
+ :::demo 配置`body-style`属性来自定义`body`部分的`style`,我们还使用了布局组件。
79
+ ```html
80
+ <el-row>
81
+ <el-col :span="8" v-for="(o, index) in 2" :key="o" :offset="index > 0 ? 2 : 0">
82
+ <el-card :body-style="{ padding: '0px' }">
83
+ <img src="https://shadow.elemecdn.com/app/element/hamburger.9cf7b091-55e9-11e9-a976-7f4d0b07eef6.png" class="image">
84
+ <div style="padding: 14px;">
85
+ <span>好吃的汉堡</span>
86
+ <div class="bottom clearfix">
87
+ <time class="time">{{ currentDate }}</time>
88
+ <el-button type="text" class="button">操作按钮</el-button>
89
+ </div>
90
+ </div>
91
+ </el-card>
92
+ </el-col>
93
+ </el-row>
94
+
95
+ <style>
96
+ .time {
97
+ font-size: 13px;
98
+ color: #999;
99
+ }
100
+
101
+ .bottom {
102
+ margin-top: 13px;
103
+ line-height: 12px;
104
+ }
105
+
106
+ .button {
107
+ padding: 0;
108
+ float: right;
109
+ }
110
+
111
+ .image {
112
+ width: 100%;
113
+ display: block;
114
+ }
115
+
116
+ .clearfix:before,
117
+ .clearfix:after {
118
+ display: table;
119
+ content: "";
120
+ }
121
+
122
+ .clearfix:after {
123
+ clear: both
124
+ }
125
+ </style>
126
+
127
+ <script>
128
+ export default {
129
+ data() {
130
+ return {
131
+ currentDate: new Date()
132
+ };
133
+ }
134
+ }
135
+ </script>
136
+ ```
137
+ :::
138
+
139
+ ### 卡片阴影
140
+
141
+ 可对阴影的显示进行配置。
142
+
143
+ :::demo 通过`shadow`属性设置卡片阴影出现的时机:`always`、`hover`或`never`。
144
+ ```html
145
+ <el-row :gutter="12">
146
+ <el-col :span="8">
147
+ <el-card shadow="always">
148
+ 总是显示
149
+ </el-card>
150
+ </el-col>
151
+ <el-col :span="8">
152
+ <el-card shadow="hover">
153
+ 鼠标悬浮时显示
154
+ </el-card>
155
+ </el-col>
156
+ <el-col :span="8">
157
+ <el-card shadow="never">
158
+ 从不显示
159
+ </el-card>
160
+ </el-col>
161
+ </el-row>
162
+ ```
163
+ :::
164
+
165
+ ### Attributes
166
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
167
+ |---------- |-------- |---------- |------------- |-------- |
168
+ | header | 设置 header,也可以通过 `slot#header` 传入 DOM | string| — | — |
169
+ | body-style | 设置 body 的样式| object| — | { padding: '20px' } |
170
+ | shadow | 设置阴影显示时机 | string | always / hover / never | always |
@@ -0,0 +1,212 @@
1
+ ## Carousel 走马灯
2
+
3
+ 在有限空间内,循环播放同一类型的图片、文字等内容
4
+
5
+ ### 基础用法
6
+
7
+ 适用广泛的基础用法
8
+
9
+ :::demo 结合使用`el-carousel`和`el-carousel-item`标签就得到了一个走马灯。幻灯片的内容是任意的,需要放在`el-carousel-item`标签中。默认情况下,在鼠标 hover 底部的指示器时就会触发切换。通过设置`trigger`属性为`click`,可以达到点击触发的效果。
10
+ ```html
11
+ <template>
12
+ <div class="block">
13
+ <span class="demonstration">默认 Hover 指示器触发</span>
14
+ <el-carousel height="150px">
15
+ <el-carousel-item v-for="item in 4" :key="item">
16
+ <h3 class="small">{{ item }}</h3>
17
+ </el-carousel-item>
18
+ </el-carousel>
19
+ </div>
20
+ <div class="block">
21
+ <span class="demonstration">Click 指示器触发</span>
22
+ <el-carousel trigger="click" height="150px">
23
+ <el-carousel-item v-for="item in 4" :key="item">
24
+ <h3 class="small">{{ item }}</h3>
25
+ </el-carousel-item>
26
+ </el-carousel>
27
+ </div>
28
+ </template>
29
+
30
+ <style>
31
+ .el-carousel__item h3 {
32
+ color: #475669;
33
+ font-size: 14px;
34
+ opacity: 0.75;
35
+ line-height: 150px;
36
+ margin: 0;
37
+ }
38
+
39
+ .el-carousel__item:nth-child(2n) {
40
+ background-color: #99a9bf;
41
+ }
42
+
43
+ .el-carousel__item:nth-child(2n+1) {
44
+ background-color: #d3dce6;
45
+ }
46
+ </style>
47
+ ```
48
+ :::
49
+
50
+ ### 指示器
51
+
52
+ 可以将指示器的显示位置设置在容器外部
53
+
54
+ :::demo `indicator-position`属性定义了指示器的位置。默认情况下,它会显示在走马灯内部,设置为`outside`则会显示在外部;设置为`none`则不会显示指示器。
55
+ ```html
56
+ <template>
57
+ <el-carousel indicator-position="outside">
58
+ <el-carousel-item v-for="item in 4" :key="item">
59
+ <h3>{{ item }}</h3>
60
+ </el-carousel-item>
61
+ </el-carousel>
62
+ </template>
63
+
64
+ <style>
65
+ .el-carousel__item h3 {
66
+ color: #475669;
67
+ font-size: 18px;
68
+ opacity: 0.75;
69
+ line-height: 300px;
70
+ margin: 0;
71
+ }
72
+
73
+ .el-carousel__item:nth-child(2n) {
74
+ background-color: #99a9bf;
75
+ }
76
+
77
+ .el-carousel__item:nth-child(2n+1) {
78
+ background-color: #d3dce6;
79
+ }
80
+ </style>
81
+ ```
82
+ :::
83
+
84
+ ### 切换箭头
85
+ 可以设置切换箭头的显示时机
86
+
87
+ :::demo `arrow`属性定义了切换箭头的显示时机。默认情况下,切换箭头只有在鼠标 hover 到走马灯上时才会显示;若将`arrow`设置为`always`,则会一直显示;设置为`never`,则会一直隐藏。
88
+ ```html
89
+ <template>
90
+ <el-carousel :interval="5000" arrow="always">
91
+ <el-carousel-item v-for="item in 4" :key="item">
92
+ <h3>{{ item }}</h3>
93
+ </el-carousel-item>
94
+ </el-carousel>
95
+ </template>
96
+
97
+ <style>
98
+ .el-carousel__item h3 {
99
+ color: #475669;
100
+ font-size: 18px;
101
+ opacity: 0.75;
102
+ line-height: 300px;
103
+ margin: 0;
104
+ }
105
+
106
+ .el-carousel__item:nth-child(2n) {
107
+ background-color: #99a9bf;
108
+ }
109
+
110
+ .el-carousel__item:nth-child(2n+1) {
111
+ background-color: #d3dce6;
112
+ }
113
+ </style>
114
+ ```
115
+ :::
116
+
117
+ ### 卡片化
118
+ 当页面宽度方向空间空余,但高度方向空间匮乏时,可使用卡片风格
119
+
120
+ :::demo 将`type`属性设置为`card`即可启用卡片模式。从交互上来说,卡片模式和一般模式的最大区别在于,可以通过直接点击两侧的幻灯片进行切换。
121
+ ```html
122
+ <template>
123
+ <el-carousel :interval="4000" type="card" height="200px">
124
+ <el-carousel-item v-for="item in 6" :key="item">
125
+ <h3 class="medium">{{ item }}</h3>
126
+ </el-carousel-item>
127
+ </el-carousel>
128
+ </template>
129
+
130
+ <style>
131
+ .el-carousel__item h3 {
132
+ color: #475669;
133
+ font-size: 14px;
134
+ opacity: 0.75;
135
+ line-height: 200px;
136
+ margin: 0;
137
+ }
138
+
139
+ .el-carousel__item:nth-child(2n) {
140
+ background-color: #99a9bf;
141
+ }
142
+
143
+ .el-carousel__item:nth-child(2n+1) {
144
+ background-color: #d3dce6;
145
+ }
146
+ </style>
147
+ ```
148
+ :::
149
+
150
+ ### 方向
151
+ 默认情况下,`direction` 为 `horizontal`。通过设置 `direction` 为 `vertical` 来让走马灯在垂直方向上显示。
152
+ :::demo
153
+ ```html
154
+ <template>
155
+ <el-carousel height="200px" direction="vertical" :autoplay="false">
156
+ <el-carousel-item v-for="item in 3" :key="item">
157
+ <h3 class="medium">{{ item }}</h3>
158
+ </el-carousel-item>
159
+ </el-carousel>
160
+ </template>
161
+
162
+ <style>
163
+ .el-carousel__item h3 {
164
+ color: #475669;
165
+ font-size: 14px;
166
+ opacity: 0.75;
167
+ line-height: 200px;
168
+ margin: 0;
169
+ }
170
+
171
+ .el-carousel__item:nth-child(2n) {
172
+ background-color: #99a9bf;
173
+ }
174
+
175
+ .el-carousel__item:nth-child(2n+1) {
176
+ background-color: #d3dce6;
177
+ }
178
+ </style>
179
+ ```
180
+ :::
181
+
182
+ ### Carousel Attributes
183
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
184
+ |---------- |-------------- |---------- |-------------------------------- |-------- |
185
+ | height | 走马灯的高度 | string | — | — |
186
+ | initial-index | 初始状态激活的幻灯片的索引,从 0 开始 | number | — | 0 |
187
+ | trigger | 指示器的触发方式 | string | click | — |
188
+ | autoplay | 是否自动切换 | boolean | — | true |
189
+ | interval | 自动切换的时间间隔,单位为毫秒 | number | — | 3000 |
190
+ | indicator-position | 指示器的位置 | string | outside/none | — |
191
+ | arrow | 切换箭头的显示时机 | string | always/hover/never | hover |
192
+ | type | 走马灯的类型 | string | card | — |
193
+ | loop | 是否循环显示 | boolean | - | true |
194
+ | direction | 走马灯展示的方向 | string | horizontal/vertical | horizontal |
195
+
196
+ ### Carousel Events
197
+ | 事件名称 | 说明 | 回调参数 |
198
+ |---------|---------|---------|
199
+ | change | 幻灯片切换时触发 | 目前激活的幻灯片的索引,原幻灯片的索引 |
200
+
201
+ ### Carousel Methods
202
+ | 方法名 | 说明 | 参数 |
203
+ |---------- |-------------- | -- |
204
+ | setActiveItem | 手动切换幻灯片 | 需要切换的幻灯片的索引,从 0 开始;或相应 `el-carousel-item` 的 `name` 属性值 |
205
+ | prev | 切换至上一张幻灯片 | — |
206
+ | next | 切换至下一张幻灯片 | — |
207
+
208
+ ### Carousel-Item Attributes
209
+ | 参数 | 说明 | 类型 | 可选值 | 默认值 |
210
+ |---------- |-------------- |---------- |-------------------------------- |-------- |
211
+ | name | 幻灯片的名字,可用作 `setActiveItem` 的参数 | string | — | — |
212
+ | label | 该幻灯片所对应指示器的文本 | string | — | — |