Objectnull滑动配置
{
currentPage: 0,//当前页码
thresholdDistance: 500,//滑动判定距离
thresholdTime: 100,//滑动判定时间
autoplay:1000,//自动滚动[ms]
loop:true,//循环滚动
direction:'vertical',//方向设置,垂直滚动
loopedSlides:1,//无限滚动前后遍历数
slidesToScroll:1,//每次滑动项数
}
stringslide切换效果,默认为滚动滑动('slide'),可设置为渐变滑动('fade'),旋转滚动('coverflow')
{
effect:'slide'
}
stringhorizontal方向设置,默认为水平滚动('horizontal'),可设置为垂直滚动('vertical')
{
direction:'horizontal'
}
number0初始化slider时为第几页
{
currentPage:0
}
number100触发滑动的距离阈值
{
thresholdDistance:'100'
}
number500触发滑动的时间阈值
{
thresholdTime:'500'
}
numbernumber[ms]自动播放的时间
{
autoplay:'1000'
}
booleanfalse是否循环滚动
{
loop:false
}
number1loop设置为true时,设置前后复制页面的数量
{
loopedSlides:1
}
number1每次滑动切换的页数
{
slidesToScroll:1
}
booleanfalse阻止touch事件触发时,整个页面的滚动
{
preventDocumentMove:true
}
number[ms]300滑动持续时间[ms]
{
speed: 300
}
stringease滑动方式
{
timingFunction: 'ease'
}
booleantrue所有模式下分页是否显示
{
pagination: true
}
functionnullcreateElement, index自定义分页函数,参数为vue的createElement函数,和当前页码index
{
renderPagination: (h, index) => {
return h('div', {
class: 'swiper-pagination-bullet'
}, [index])
}
}
booleanfalse是否居中滑动
{
centeredSlides: true
}
booleanfalse在无限滚动中使用itemAnimation,保证最后一个到第一个(第一个到最后一个)特效结束后才能继续滑动
{
itemAnimation: true
}
booleanfalse阻止touch滑动
{
freeze: false
}
booleanfalse阻止回弹
{
preventRebound: false
}
string0.8coverflow模式下配置宽度比例缩放,范围0~1
{
widthScalingRatio: '0.8'
}
string0.8coverflow模式下配置高度比例缩放,范围0~1
{
heightScalingRatio: '0.8'
}
string200coverflow模式下配置滑动项偏移
{
deviation: '200'
}
booleantrue用于嵌套相同方向的swiper时,当子swiper切换完的时候,开启父swiper的切换
{
nested: false
}
number滑动到(number)页
slideTo () {
this.$refs.slider.$emit('slideTo', num)
}
null滑动到下一页
slideNext () {
this.$refs.slider.$emit('slideNext')
}
null滑动到上一页
slide () {
this.$refs.slider.$emit('slidePre')
}
ms开启定时轮播,设置轮播时长
this.$refs.slider.$emit('autoplayStart',1000)
暂停定时轮播
this.$refs.slider.$emit('autoplayStop')
obj当前滑动到第几页,参数为slider基础信息
slide (data) {
console.log(data)
}
obj当前点击第几页,参数为slider基础信息
tap (data) {
console.log(data)
}
obj初始化成功事件,参数为slider基础信息
init (data) {
console.log(data)
}