# Swiper 轮播
# 使用指南
用于进行滑动切换场景,例如轮播图片或者tab内容。
# 代码演示
# 与h3-mobile-vue组件的区别以及迁移
旧组件库轮播存在内置图片处理,为了让swiper组件更加纯粹,因此弃用内置图片处理及内置分页器。
若要做迁移请参考
弃用的props:
list
dotsPosition
showDots
showDescMask
height
aspectRatio
mode
替换的props:
value
=>index
maxLength
=>maxlength
editable
=>readonly
新增的props:
wait
border
password
弃用原来所有的事件
# API - H3Swiper
# Props - H3Swiper
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
index | 当前显示的 swipeItem 索引 或 item的 name ,v-model 绑定值 | string|number | 0 |
direction | 轮播方向 vertical horizontal | string | horizontal |
auto | 是否自动 | boolean | false |
loop | 是否循环播放 | boolean | false |
interval | 轮播间隔时间,单位 ms | string|number | 3000 |
threshold | 滑动的临界值 | string|number | 0 |
duration | 动画持续时间,单位 ms | string|number | 300 |
itemWidth | 设置swiper-item 宽度,当direction=horizontal 时有效,若设置了,请把loop 设置为false | string|number | - |
itemHeight | 设置swiper-item 高度,当direction=vertical 时有效,若设置了,请把loop 设置为false | string|number | - |
center | 当设置了item-width item-height 时 是否居中显示 | boolean | true |
touchable | 是否可手动滑动 | boolean | true |
# Events - H3Swiper
事件名 | 说明 | 参数 |
---|---|---|
input | swipeItem 索引变化时触发,v-model 绑定事件 | value: 当前索引 |
change | swipeItem 索引变化时触发 | options: {curr: 当前索引, prev: 前一个索引(若为-1则无前一个), next: 后一个索引(若为-1则无后一个), count: 总数} |
# Function - H3Swiper
- 实例方法
方法名 | 说明 | 参数 |
---|---|---|
prev | 滑动到前一个 | - |
next | 滑动到后一个 | - |
swipeTo | 滑动到指定一个 | index |
refresh | 刷新组件 | - |
# API - H3SwiperItem
# Props - H3SwiperItem
参数 | 说明 | 类型 | 默认值 |
---|---|---|---|
name | item名称,作为匹配的标识符 | string | - |