@gmcb/uv-ui 0.2.27 → 0.3.1

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 (135) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +95 -141
  4. package/docs/api/configs/color.md +52 -0
  5. package/docs/api/index.md +77 -0
  6. package/docs/api/mixins/mpShare.md +95 -0
  7. package/docs/api/request/apiManage.md +88 -0
  8. package/docs/api/request/http.md +451 -0
  9. package/docs/api/utils/colorSwitch.md +78 -0
  10. package/docs/api/utils/debounce.md +104 -0
  11. package/docs/api/utils/fastUse.md +246 -0
  12. package/docs/api/utils/getRect.md +238 -0
  13. package/docs/api/utils/guid.md +41 -0
  14. package/docs/api/utils/index.md +55 -0
  15. package/docs/api/utils/intro.md +25 -0
  16. package/docs/api/utils/object.md +171 -0
  17. package/docs/api/utils/queryParams.md +68 -0
  18. package/docs/api/utils/random.md +23 -0
  19. package/docs/api/utils/randomArray.md +28 -0
  20. package/docs/api/utils/route.md +121 -0
  21. package/docs/api/utils/test.md +237 -0
  22. package/docs/api/utils/time.md +81 -0
  23. package/docs/api/utils/trim.md +24 -0
  24. package/docs/components/actionSheet.md +236 -0
  25. package/docs/components/addQQGroup.md +5 -0
  26. package/docs/components/album.md +91 -0
  27. package/docs/components/alert.md +83 -0
  28. package/docs/components/avatar.md +152 -0
  29. package/docs/components/backTop.md +181 -0
  30. package/docs/components/badge.md +117 -0
  31. package/docs/components/button.md +196 -0
  32. package/docs/components/calendar.md +398 -0
  33. package/docs/components/calendars.md +294 -0
  34. package/docs/components/cell.md +185 -0
  35. package/docs/components/checkbox.md +281 -0
  36. package/docs/components/circleProgress.md +5 -0
  37. package/docs/components/code.md +162 -0
  38. package/docs/components/codeInput.md +175 -0
  39. package/docs/components/collapse.md +250 -0
  40. package/docs/components/color.md +324 -0
  41. package/docs/components/common.md +126 -0
  42. package/docs/components/countDown.md +166 -0
  43. package/docs/components/countTo.md +140 -0
  44. package/docs/components/datetimePicker.md +283 -0
  45. package/docs/components/diff1.x.md +190 -0
  46. package/docs/components/divider.md +88 -0
  47. package/docs/components/downloadSetting.md +54 -0
  48. package/docs/components/dropDown.md +375 -0
  49. package/docs/components/empty.md +99 -0
  50. package/docs/components/feature.md +261 -0
  51. package/docs/components/form.md +736 -0
  52. package/docs/components/gap.md +49 -0
  53. package/docs/components/grid.md +225 -0
  54. package/docs/components/icon.md +101 -0
  55. package/docs/components/image.md +182 -0
  56. package/docs/components/index.md +110 -0
  57. package/docs/components/indexList.md +133 -0
  58. package/docs/components/input.md +250 -0
  59. package/docs/components/install.md +59 -0
  60. package/docs/components/intro.md +32 -0
  61. package/docs/components/keyboard.md +226 -0
  62. package/docs/components/layout.md +310 -0
  63. package/docs/components/line.md +85 -0
  64. package/docs/components/lineProgress.md +141 -0
  65. package/docs/components/link.md +89 -0
  66. package/docs/components/list.md +223 -0
  67. package/docs/components/loadMore.md +140 -0
  68. package/docs/components/loadingIcon.md +144 -0
  69. package/docs/components/loadingPage.md +92 -0
  70. package/docs/components/modal.md +230 -0
  71. package/docs/components/more.md +13 -0
  72. package/docs/components/navbar.md +192 -0
  73. package/docs/components/noNetwork.md +116 -0
  74. package/docs/components/noticeBar.md +131 -0
  75. package/docs/components/notify.md +204 -0
  76. package/docs/components/npmSetting.md +64 -0
  77. package/docs/components/numberBox.md +257 -0
  78. package/docs/components/nvue.md +170 -0
  79. package/docs/components/overlay.md +117 -0
  80. package/docs/components/parse.md +204 -0
  81. package/docs/components/pickColor.md +112 -0
  82. package/docs/components/picker.md +357 -0
  83. package/docs/components/popup.md +221 -0
  84. package/docs/components/problem.md +300 -0
  85. package/docs/components/qrcode.md +169 -0
  86. package/docs/components/quickstart.md +33 -0
  87. package/docs/components/radio.md +256 -0
  88. package/docs/components/rate.md +128 -0
  89. package/docs/components/read.md +163 -0
  90. package/docs/components/readMore.md +227 -0
  91. package/docs/components/resource.md +17 -0
  92. package/docs/components/scrollList.md +218 -0
  93. package/docs/components/search.md +160 -0
  94. package/docs/components/setting.md +111 -0
  95. package/docs/components/settingDesc.md +66 -0
  96. package/docs/components/skeleton.md +105 -0
  97. package/docs/components/skeletons.md +323 -0
  98. package/docs/components/slider.md +157 -0
  99. package/docs/components/steps.md +189 -0
  100. package/docs/components/sticky.md +76 -0
  101. package/docs/components/subsection.md +183 -0
  102. package/docs/components/swipeAction.md +279 -0
  103. package/docs/components/swiper.md +352 -0
  104. package/docs/components/switch.md +216 -0
  105. package/docs/components/tabbar.md +263 -0
  106. package/docs/components/table.md +5 -0
  107. package/docs/components/tabs.md +364 -0
  108. package/docs/components/tag.md +227 -0
  109. package/docs/components/testPic.md +20 -0
  110. package/docs/components/text.md +157 -0
  111. package/docs/components/textarea.md +121 -0
  112. package/docs/components/toast.md +124 -0
  113. package/docs/components/tooltip.md +98 -0
  114. package/docs/components/transition.md +404 -0
  115. package/docs/components/upload.md +253 -0
  116. package/docs/components/vtabs.md +332 -0
  117. package/docs/components/vueUse.md +45 -0
  118. package/docs/components/vuexDetail.md +103 -0
  119. package/docs/components/waterfall.md +651 -0
  120. package/docs/faq/index.md +53 -0
  121. package/docs/guide/codeHint.md +44 -0
  122. package/docs/guide/customIcon.md +168 -0
  123. package/docs/guide/demo.md +92 -0
  124. package/docs/guide/design.md +56 -0
  125. package/docs/guide/globalVariable.md +239 -0
  126. package/docs/guide/i18n.md +194 -0
  127. package/docs/guide/index.md +28 -0
  128. package/docs/guide/note.md +74 -0
  129. package/docs/guide/safeAreaInset.md +64 -0
  130. package/docs/guide/theme.md +67 -0
  131. package/docs/index.md +88 -0
  132. package/libs/config/config.js +0 -10
  133. package/libs/css/color.scss +15 -14
  134. package/package.json +7 -2
  135. package/theme.scss +2 -1
@@ -0,0 +1,279 @@
1
+ ## SwipeAction 滑动单元格 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/swipeAction/swipeAction"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-swipe-action > uv-swipe-action-item**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-swipe-action)
10
+
11
+ :::
12
+
13
+ 该组件一般用于左滑唤出操作菜单的场景,用的最多的是左滑删除操作。
14
+
15
+
16
+ ::: warning 注意
17
+ 如果把该组件通过v-for用于左滑删除的列表,请保证循环的`:key`是一个唯一值,可以用数据的id或者title替代。
18
+ 不能是数组循环的index,否则删除的时候,可能会出现数据错乱
19
+ :::
20
+
21
+ ### 平台兼容性
22
+
23
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
24
+ |:-:|:-:|:-:|:-:|:-:|:-:|
25
+ |√|√|√|√(仅支持微信、QQ小程序)|√|√|
26
+
27
+ ### 基本使用
28
+
29
+ - 通过`slot`传入内部内容即可,可以将`v-for`的`index`索引值传递给`index`参数,用于点击时,在回调方法中对某一个数据进行操作(点击回调时第一个参数会返回此索引值)
30
+ - 内部的按钮通过`options`参数配置,此参数为一个数组,元素为对象,可以配置按钮的文字,背景颜色(建议只配置此两个参数即可),**请勿配置宽高等属性**。
31
+
32
+
33
+ ```vue
34
+ <template>
35
+ <view>
36
+ <uv-swipe-action>
37
+ <uv-swipe-action-item :options="options">
38
+ <view class="swipe-action uv-border-top uv-border-bottom">
39
+ <view class="swipe-action__content">
40
+ <text class="swipe-action__content__text">基础使用</text>
41
+ </view>
42
+ </view>
43
+ </uv-swipe-action-item>
44
+ </uv-swipe-action>
45
+ </view>
46
+ </template>
47
+ <script setup>
48
+ import { ref } from 'vue';
49
+
50
+ const options = ref([{
51
+ text: '删除',
52
+ style: {
53
+ backgroundColor: '#f56c6c'
54
+ }
55
+ }]);
56
+
57
+ </script>
58
+ <style lang="scss">
59
+ .uv-page {
60
+ padding: 0;
61
+ }
62
+ .uv-demo-block__title {
63
+ padding: 10px 0 2px 15px;
64
+ }
65
+ .swipe-action {
66
+ &__content {
67
+ padding: 25rpx 0;
68
+ &__text {
69
+ font-size: 15px;
70
+ color: #222;
71
+ padding-left: 30rpx;
72
+ }
73
+ }
74
+ }
75
+ </style>
76
+ ```
77
+
78
+ ### 多个按钮并列
79
+
80
+ 通过`options`属性值,达到多个并列的效果
81
+
82
+ ```vue
83
+ <template>
84
+ <view>
85
+ <uv-swipe-action>
86
+ <uv-swipe-action-item :options="options">
87
+ <view class="swipe-action uv-border-top uv-border-bottom">
88
+ <view class="swipe-action__content">
89
+ <text class="swipe-action__content__text">两个按钮并列</text>
90
+ </view>
91
+ </view>
92
+ </uv-swipe-action-item>
93
+ </uv-swipe-action>
94
+ </view>
95
+ </template>
96
+ <script setup>
97
+ import { ref } from 'vue';
98
+
99
+ const options = ref([{
100
+ text: '收藏',
101
+ style: {
102
+ backgroundColor: '#3c9cff'
103
+ }
104
+ }, {
105
+ text: '删除',
106
+ style: {
107
+ backgroundColor: '#f56c6c'
108
+ }
109
+ }]);
110
+
111
+ </script>
112
+ <style lang="scss">
113
+ .uv-page {
114
+ padding: 0;
115
+ }
116
+ .uv-demo-block__title {
117
+ padding: 10px 0 2px 15px;
118
+ }
119
+ .swipe-action {
120
+ &__content {
121
+ padding: 25rpx 0;
122
+ &__text {
123
+ font-size: 15px;
124
+ color: #222;
125
+ padding-left: 30rpx;
126
+ }
127
+ }
128
+ }
129
+ </style>
130
+ ```
131
+
132
+ ### 组合使用
133
+
134
+ 通过`options`属性的`options`值达成组合效果
135
+
136
+ ```vue
137
+ <template>
138
+ <view>
139
+ <uv-swipe-action>
140
+ <uv-swipe-action-item
141
+ :options="item.options"
142
+ v-for="(item, index) in options"
143
+ :disabled="item.disabled"
144
+ :key="index">
145
+ <view class="swipe-action uv-border-top"
146
+ :class="[index === options.length - 1 && 'uv-border-bottom']">
147
+ <view class="swipe-action__content">
148
+ <text class="swipe-action__content__text">{{ item.text }}</text>
149
+ </view>
150
+ </view>
151
+ </uv-swipe-action-item>
152
+ </uv-swipe-action>
153
+ </view>
154
+ </template>
155
+ <script setup>
156
+ import { ref } from 'vue';
157
+
158
+ const options = ref([{
159
+ text: '禁用状态',
160
+ disabled: true,
161
+ options: [{
162
+ text: '置顶',
163
+ style: {
164
+ backgroundColor: '#3c9cff'
165
+ }
166
+ }, {
167
+ text: '取消',
168
+ style: {
169
+ backgroundColor: '#f9ae3d'
170
+ }
171
+ }]
172
+ }, {
173
+ text: '正常状态',
174
+ disabled: false,
175
+ options: [{
176
+ text: '置顶',
177
+ style: {
178
+ backgroundColor: '#3c9cff'
179
+ }
180
+ }, {
181
+ text: '取消',
182
+ style: {
183
+ backgroundColor: '#f9ae3d'
184
+ }
185
+ }]
186
+ }, {
187
+ text: '自动关闭',
188
+ disabled: false,
189
+ options: [{
190
+ text: '置顶',
191
+ style: {
192
+ backgroundColor: '#3c9cff'
193
+ }
194
+ }, {
195
+ text: '取消',
196
+ style: {
197
+ backgroundColor: '#f9ae3d'
198
+ }
199
+ }]
200
+ }]);
201
+
202
+ </script>
203
+
204
+ <style lang="scss">
205
+ .uv-page {
206
+ padding: 0;
207
+ }
208
+ .uv-demo-block__title {
209
+ padding: 10px 0 2px 15px;
210
+ }
211
+ .swipe-action {
212
+ &__content {
213
+ padding: 25rpx 0;
214
+ &__text {
215
+ font-size: 15px;
216
+ color: #222;
217
+ padding-left: 30rpx;
218
+ }
219
+ }
220
+ }
221
+ </style>
222
+ ```
223
+
224
+ ### 完整示例
225
+
226
+ ::: tip 完整示例下载地址
227
+
228
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
229
+
230
+ :::
231
+
232
+ ### API
233
+ ---
234
+
235
+ ### SwipeAction Props
236
+
237
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
238
+ |:- |:- |:- |:- |:- |
239
+ | autoClose | 是否自动关闭其他swipe按钮组 | Boolean | true | true &#124; false |
240
+
241
+ ### SwipeAction Events
242
+
243
+ |事件名 |说明 |回调参数 |
244
+ |:- |:- |:- |
245
+ | @click | 点击组件时触发 | index |
246
+
247
+ ### SwipeActionItem Props
248
+
249
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
250
+ |:- |:- |:- |:- |:- |
251
+ | show | 控制打开或者关闭 | Boolean | false | true &#124; false |
252
+ | index | 标识符,如果是`v-for`,可用`index`索引 | String &#124; Number | - | - |
253
+ | disabled | 是否禁用 | Boolean | false | true &#124; false |
254
+ | autoClose | 是否自动关闭其他swipe按钮组 | Boolean | true | true &#124; false |
255
+ | threshold | 滑动距离阈值,只有大于此值,才被认为是要打开菜单 | Number | 20 | - |
256
+ | options | 右侧按钮内容 | Array | [] | - |
257
+ | duration | 动画过渡时间,单位`ms` | String &#124; Number | 300 | - |
258
+ | name | 标识符,如果是`v-for`,可用`index`索引值 | String &#124; Number | - | - |
259
+
260
+ ### SwipeActionItem Events
261
+
262
+ |事件名 |说明 |回调参数 |
263
+ |:- |:- |:- |
264
+ | @click | 按钮被点击时触发 | name: props参数`name`的值,index: 第几个按钮被点击 |
265
+
266
+ <style scoped>
267
+ h3[id=swipeaction-events] + table thead tr th:nth-child(2){
268
+ width: 40%;
269
+ }
270
+ h3[id=swipeaction-events] + table thead tr th:nth-child(3){
271
+ width: 40%;
272
+ }
273
+ h3[id=swipeactionitem-events] + table thead tr th:nth-child(2){
274
+ width: 40%;
275
+ }
276
+ h3[id=swipeactionitem-events] + table thead tr th:nth-child(3){
277
+ width: 40%;
278
+ }
279
+ </style>
@@ -0,0 +1,352 @@
1
+ ## Swiper 轮播图 <to-api/>
2
+
3
+ <demo-model url="/pages/componentsC/swiper/swiper"></demo-model>
4
+
5
+ ::: tip ✈
6
+
7
+ **组件名:uv-swiper**
8
+
9
+ [点击下载&安装](https://ext.dcloud.net.cn/plugin?name=uv-swiper)
10
+
11
+ :::
12
+
13
+ 该组件一般用于导航轮播,banner展示等场景,可开箱即用,具有如下特点:
14
+ - 自定义指示器模式,可配置指示器样式
15
+ - 3D轮播图效果,满足不同的开发需求
16
+ - 可配置显示标题,涵盖不同的应用场景
17
+ - 具有设置加载状态和嵌入视频的能力,功能齐全丰富
18
+
19
+
20
+ ### 平台兼容性
21
+
22
+ |App(vue)|App(nvue)|H5|小程序|VUE2|VUE3|
23
+ |:-:|:-:|:-:|:-:|:-:|:-:|
24
+ |√|√|√|√|√|√|
25
+
26
+ :::warning 注意事项
27
+ > 为了避免错误使用,给大家带来不好的开发体验,请在使用组件前仔细阅读下面的注意事项,可以帮你避免一些错误。
28
+ 1. swiper在App的vue中、百度支付宝头条QQ小程序中,不支持内嵌video、map等原生组件。在微信基础库2.4.4起和App nvue2.1.5起支持内嵌原生组件。
29
+ 2. `uv-swiper` 是在uni提供的swiper基础上进行封装,更多问题可以去[官方swiper查看](https://uniapp.dcloud.net.cn/component/swiper.html)
30
+ :::
31
+
32
+ ### 基本使用
33
+
34
+ 通过`list`参数传入轮播图列表值,该值为一个数组,键值为图片路径,例如:
35
+
36
+ ```vue
37
+ <template>
38
+ <uv-swiper :list="list"></uv-swiper>
39
+ </template>
40
+ <script setup>
41
+ import { ref } from 'vue';
42
+
43
+ const list = ref(['https://cdn.uviewui.com/uview/swiper/swiper1.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper3.png']);
44
+
45
+ </script>
46
+ ```
47
+
48
+ ### 带标题
49
+
50
+ - 通过`showTitle`属性以展示标题,此时`list`的参数应为一个对象,如下示例:
51
+ - 通过`titleStyle`属性设置标题的样式
52
+
53
+ ::: warning 注意
54
+ 您期望使用对象作为参数时,需要配置`uv-swiper`组件的`keyName`参数为`您当前对象的图片key`值)如:`keyName="image"`
55
+ :::
56
+
57
+ ```vue
58
+ <template>
59
+ <uv-swiper
60
+ :list="list"
61
+ keyName="image"
62
+ showTitle
63
+ :title-style="{color:'red',textAlign: 'center'}"
64
+ :autoplay="false"
65
+ circular></uv-swiper>
66
+ </template>
67
+ <script setup>
68
+ import { ref } from 'vue';
69
+
70
+ const list = ref([{
71
+ image: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
72
+ title: '丙辰中秋,欢饮达旦,大醉,作此篇,兼怀子由'
73
+ }, {
74
+ image: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
75
+ title: '明月几时有?把酒问青天'
76
+ }, {
77
+ image: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
78
+ title: '不知天上宫阙,今夕是何年'
79
+ }]);
80
+
81
+ </script>
82
+ ```
83
+ ### 带指示器
84
+
85
+ - 通过`indicator`属性添加指示器
86
+ - 通过`indicatorMode`属性设置指示器的类型:`line` - 线形状 `dot` - 点形状
87
+
88
+ ```vue
89
+ <template>
90
+ <uv-swiper :list="list" indicator indicatorMode="line" circular></uv-swiper>
91
+ </template>
92
+ <script setup>
93
+ import { ref } from 'vue';
94
+
95
+ const list = ref(['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png']);
96
+
97
+ </script>
98
+ ```
99
+ ### 加载中
100
+
101
+ 通过添加`loading`属性设置加载中的状态
102
+ <br/>
103
+ 您也可以动态的来控制加载状态,比如:`:loading='loading'`
104
+
105
+ ```vue
106
+ <template>
107
+ <uv-swiper :list="[]" loading></uv-swiper>
108
+ </template>
109
+ ```
110
+ ### 嵌入视频
111
+
112
+ 我们提供了嵌入视频的能力,为避免资源浪费,在您切换轮播的时候视频会停止播放,你可以设置`poster`指定视频封面,案例如下:
113
+
114
+ :::warning 注意事项
115
+ 1. swiper在App的vue中、百度支付宝头条QQ小程序中,不支持内嵌video、map等原生组件。在微信基础库2.4.4起和App nvue2.1.5起支持内嵌原生组件。
116
+ :::
117
+
118
+ ```vue
119
+ <template>
120
+ <uv-swiper :list="list" keyName="url" :autoplay="false"></uv-swiper>
121
+ </template>
122
+ <script setup>
123
+ import { ref } from 'vue';
124
+
125
+ const list = ref([{
126
+ url: 'https://cdn.uviewui.com/uview/resources/video.mp4',
127
+ title: '昨夜星辰昨夜风,画楼西畔桂堂东',
128
+ poster: 'https://cdn.uviewui.com/uview/swiper/swiper1.png'
129
+ }, {
130
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
131
+ title: '身无彩凤双飞翼,心有灵犀一点通'
132
+ }, {
133
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
134
+ title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
135
+ }]);
136
+
137
+ </script>
138
+ ```
139
+
140
+ ### 指定类型
141
+
142
+ 默认会根据链接自动判断`swiper-item`类型,但是在极端情况下可能会不准确,所以我们提供了指定`item`的类型,通过设置`type`为`video`或`image`,如下:
143
+
144
+ ```vue
145
+ <template>
146
+ <uv-swiper :list="list" keyName="url" :autoplay="false"></uv-swiper>
147
+ </template>
148
+ <script setup>
149
+ import { ref } from 'vue';
150
+
151
+ const list = ref([{
152
+ url: 'https://cdn.uviewui.com/uview/resources/video.mp4',
153
+ title: '昨夜星辰昨夜风,画楼西畔桂堂东',
154
+ poster: 'https://cdn.uviewui.com/uview/swiper/swiper1.png',
155
+ type: 'video'
156
+ }, {
157
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper2.png',
158
+ title: '身无彩凤双飞翼,心有灵犀一点通',
159
+ type: 'image'
160
+ }, {
161
+ url: 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
162
+ title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
163
+ }]);
164
+
165
+ </script>
166
+ ```
167
+
168
+ ### 自定义指示器
169
+
170
+ 如您需要以指示点或数字形式来自定义指示器,请参考如下案例:
171
+
172
+ ```vue
173
+ <template>
174
+ <view class="uv-demo-block">
175
+ <text class="uv-demo-block__title">自定义指示器</text>
176
+ <uv-swiper
177
+ :list="list1"
178
+ @change="e => current1 = e.current"
179
+ :autoplay="false">
180
+ <template v-slot:indicator>
181
+ <view class="indicator">
182
+ <view class="indicator__dot"
183
+ v-for="(item, index) in list1"
184
+ :key="index"
185
+ :class="[index === current1 && 'indicator__dot--active']"
186
+ ></view>
187
+ </view>
188
+ </template>
189
+ </uv-swiper>
190
+ <view style="height: 15px;"></view>
191
+ <uv-swiper
192
+ :list="list2"
193
+ @change="e => current2 = e.current"
194
+ :autoplay="false"
195
+ indicatorStyle="right: 20px">
196
+ <template v-slot:indicator>
197
+ <view class="indicator-num">
198
+ <text class="indicator-num__text">{{ current2 + 1 }}/{{ list2.length }}</text>
199
+ </view>
200
+ </template>
201
+ </uv-swiper>
202
+ </view>
203
+ </template>
204
+ <script setup>
205
+ import { ref } from 'vue';
206
+
207
+ const current1 = ref(0);
208
+ const current2 = ref(0);
209
+ const list1 = ref(['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png']);
210
+ const list2 = ref(['https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png']);
211
+
212
+ </script>
213
+ <style lang="scss">
214
+ @mixin flex($direction: row) {
215
+ /* #ifndef APP-NVUE */
216
+ display: flex;
217
+ /* #endif */
218
+ flex-direction: $direction;
219
+ }
220
+ .indicator {
221
+ @include flex(row);
222
+ justify-content: center;
223
+ &__dot {
224
+ height: 6px;
225
+ width: 6px;
226
+ border-radius: 100px;
227
+ background-color: rgba(255, 255, 255, 0.35);
228
+ margin: 0 5px;
229
+ transition: background-color 0.3s;
230
+ &--active {
231
+ background-color: #ffffff;
232
+ }
233
+ }
234
+ }
235
+ .indicator-num {
236
+ padding: 2px 0;
237
+ background-color: rgba(0, 0, 0, 0.35);
238
+ border-radius: 100px;
239
+ width: 35px;
240
+ @include flex;
241
+ justify-content: center;
242
+ &__text {
243
+ color: #FFFFFF;
244
+ font-size: 12px;
245
+ }
246
+ }
247
+ </style>
248
+ ```
249
+ ### 卡片式轮播
250
+
251
+ 在实际开发中,普通的轮播或许不能满足您的开发需求,`swiper`组件提供了卡片式轮播的api,您可以参考以下案例实现此功能
252
+
253
+ ```vue
254
+ <template>
255
+ <!-- #ifndef APP-NVUE || MP-TOUTIAO -->
256
+ <view class="uv-demo-block">
257
+ <text class="uv-demo-block__title">卡片式</text>
258
+ <uv-swiper
259
+ :list="list"
260
+ previousMargin="30"
261
+ nextMargin="30"
262
+ circular
263
+ :autoplay="false"
264
+ radius="5"
265
+ bgColor="#ffffff">
266
+ </uv-swiper>
267
+ </view>
268
+ <!-- #endif -->
269
+ </template>
270
+ <script setup>
271
+ import { ref } from 'vue';
272
+
273
+ const list = ref(['https://cdn.uviewui.com/uview/swiper/swiper3.png', 'https://cdn.uviewui.com/uview/swiper/swiper2.png', 'https://cdn.uviewui.com/uview/swiper/swiper1.png']);
274
+
275
+ </script>
276
+ ```
277
+
278
+ ### 控制轮播效果
279
+
280
+ - `autoplay` 是否自动轮播,默认为`true`
281
+ - `interval` 前后两张图自动轮播的时间间隔
282
+ - `duration` 切换一张轮播图所需的时间
283
+ - `circular` 是否衔接滑动,即到最后一张时,是否可以直接转到第一张
284
+
285
+ ### 完整示例
286
+
287
+ ::: tip 完整示例下载地址
288
+
289
+ [https://ext.dcloud.net.cn/plugin?name=uv-ui](https://ext.dcloud.net.cn/plugin?name=uv-ui)
290
+
291
+ :::
292
+
293
+ ### API
294
+ ---
295
+
296
+ ### Swiper Props
297
+
298
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
299
+ |:- |:- |:- |:- |:- |
300
+ | list | 轮播图数据,见上方"基本使用"说明 | Array | - | - |
301
+ | indicator | 是否显示面板指示器 | Boolean | false | true &#124; false |
302
+ | indicatorActiveColor | 指示器激活的颜色 | String | #FFFFFF | - |
303
+ | indicatorInactiveColor| 指示器非激活颜色 | String | rgba(255, 255, 255, 0.35) | - |
304
+ | indicatorStyle | 指示器样式,可通过bottom,left,right进行定位 | String &#124; Object | - | - |
305
+ | indicatorMode | 指示器模式 | String | line | line &#124; dot |
306
+ | autoplay | 是否自动切换 | Boolean | true | true &#124; false |
307
+ | current | 当前所在滑块的 index | Number &#124; String | 0 | - |
308
+ | currentItemId | 当前所在滑块的 item-id ,不能与 current 被同时指定,**支付宝小程序不支持** | String | - | - |
309
+ | interval | 滑块自动切换时间间隔(ms) | String &#124; Number | 3000 | - |
310
+ | duration | 滑块切换过程所需时间(ms),**nvue不支持** | String &#124; Number | 300 | - |
311
+ | circular | 播放到末尾后是否重新回到开头 | Boolean | false | true &#124; false |
312
+ | vertical<badge text="1.0.4" /> | 滑动方向是否为纵向 | Boolean | false | true &#124; false |
313
+ | previousMargin | 前边距,可用于露出前一项的一小部分,**app-nvue、抖音小程序、飞书小程序不支持** | String &#124; Number | 0 | - |
314
+ | nextMargin | 后边距,可用于露出后一项的一小部分,**app-nvue、抖音小程序、飞书小程序不支持** | String &#124; Number | 0 | - |
315
+ | acceleration | 当开启时,会根据滑动速度,连续滑动多屏,仅支付宝小程序支持 | Boolean | false | true &#124; false |
316
+ | displayMultipleItems | 同时显示的滑块数量,**nvue、支付宝小程序不支持** | Number | 1 | - |
317
+ | easingFunction | 指定swiper切换缓动动画类型, **仅支持微信小程序、快手小程序、京东小程序** | String | default | linear、easeInCubic、easeOutCubic、easeInOutCubic,参考[swiper](https://uniapp.dcloud.net.cn/component/swiper.html) |
318
+ | keyName | list数组中指定对象的目标属性名 | String | url | - |
319
+ | imgMode | 图片的裁剪模式,**不建议设置widthFix,如果图片比例不一样,理论上是会在切换的时候不断变化高度,实际上内部高度定死,所以是矛盾的,在部分平台显示会有异常** | String | aspectFill | 详见图片裁剪 |
320
+ | height | 组件高度 | String &#124; Number | 130 | - |
321
+ | bgColor | 背景颜色 | String | #f3f4f6 | - |
322
+ | radius | 组件圆角,数值或带单位的字符串 | String &#124; Number | 4 | - |
323
+ | loading | 是否加载中 | Boolean | false | true &#124; false |
324
+ | showTitle | 是否显示标题,要求数组对象中有`title`属性 | Boolean | false | - |
325
+ | titleStyle<badge text="1.0.3" /> | 显示的标题样式 | Object | - | - |
326
+
327
+ ### Swiper Events
328
+
329
+ |事件名 |说明 |回调参数 |
330
+ |:- |:- |:- |
331
+ | @click | 点击轮播图时触发 | index:点击了第几张图片,从0开始 |
332
+ | @change| 轮播图切换时触发(自动或者手动切换) | index:切换到了第几张图片,从0开始 |
333
+
334
+ ### SwiperIndicator Props
335
+
336
+ | 参数 | 说明 | 类型 | 默认值 | 可选值 |
337
+ |:- |:- |:- |:- |:- |
338
+ | length | 轮播的长度 | String &#124; Number | 0 | - |
339
+ | current | 当前处于活动状态的轮播的索引 | String &#124; Number | 0 | - |
340
+ | indicatorActiveColor | 指示器非激活颜色 | String | - | - |
341
+ | indicatorInactiveColor| 指示器的激活颜色 | String | - | - |
342
+ | indicatorStyle | 指示器的形式 | String | line | line &#124; dot |
343
+
344
+ <style scoped>
345
+ h3[id=swiper-events] + table thead tr th:nth-child(2){
346
+ width: 40%;
347
+ }
348
+ h3[id=swiper-events] + table thead tr th:nth-child(3){
349
+ width: 40%;
350
+ }
351
+ </style>
352
+