# swiper

手机 手表

# 概述

滑块视图容器

# 子组件

支持

# 属性

支持通用属性

名称 类型 默认值 必填 描述
index <number> 当前显示的子组件索引
autoplay 手表不支持 <boolean> false 渲染完成后,是否自动进行播放
interval 手表不支持 <number> 3000ms 自动播放时的时间间隔,单位毫秒
indicator <boolean> true 是否启用 indicator,默认 true
loop 手表不支持 <boolean> true 是否开启循环模式
duration 手表不支持 <number> - 滑动动画时长(duration 默认根据手指的速度动态计算)
vertical <boolean> false 滑动方向是否为纵向,纵向时 indicator 也为纵向
previousmargin <string> 0px 前边距,可用于露出前一项的一小部分,支持单位:px 和%
nextmargin <string> 0px 后边距,可用于露出后一项的一小部分,支持单位:px 和%

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

# 样式

支持通用样式

名称 类型 默认值 必填 描述
indicator-color <color> rgba(0, 0, 0, 0.5) indicator 填充颜色
indicator-selected-color <color> #33b4ff 或者 rgb(51, 180, 255) indicator 选中时的颜色
indicator-size <length> 20px indicator 组件的直径大小
indicator-[top|left|right|bottom] 1040+ <length> | <percentage> - indicator 相对于 swiper 的位置

# 事件

支持通用事件

名称 参数 描述
change {index:currentIndex} 当前显示的组件索引变化时触发

# 方法

名称 参数 描述
swipeTo {index: number(指定位置)} swiper 滚动到 index 位置

# swiper   示例代码

查看示例代码 (opens new window)