跳转到内容

swiper

滑块视图容器,支持子组件

支持通用属性

名称类型默认值必填描述
index<number>0当前显示的子组件索引
indicator<boolean>true是否启用 indicator,默认 true
scrollbar<boolean>false是否启用滚动条,如果 indicator 启用,则滚动条不会启用
vertical<boolean>false滑动方向是否为纵向,纵向时 indicator 也为纵向
previousmargin<string>0px前边距,可用于露出前一项的一小部分,支持单位:px 和%
nextmargin<string>0px后边距,可用于露出后一项的一小部分,支持单位:px 和%
enableswipe<boolean>true是否支持手势滑动 swiper
effectscrollfadescroll

备注previousmarginnextmargin的总和不应该超过整个 swiper 大小的 1/2,超过部分将会被截取。

支持通用样式

名称类型默认值必填描述
indicator-typenormalarcnormal
indicator-color<color>rgba(255, 255, 255, 0.4)indicator 填充颜色
indicator-selected-color<color>#ffffff 或者 rgb(255, 255, 255)indicator 选中时的颜色
indicator-size<length>12pxindicator 组件的直径大小
indicator-[topleftrightbottom]<length>
indicator-spacing<number>-indicator 间距,indicator-type 为 normal 时指间隔距离,indicator-type 为 arc 时指间隔角度

支持通用事件

名称参数描述
change{index:currentIndex}当前显示的组件索引变化时触发
scrollbottom-滑动到底部或者最右边
scrolltop-滑动到顶部或者最左边
名称参数描述
swipeToObjectswiper 滚动到 index 位置
名称类型是否必选默认值备注
indexnumberswiper 滚动到 index 位置
behaviorsmoothinstantauto