raf实现的vue轮播表(点击暂停、悬浮暂停等)

因业务需要自己写了个vue版轮播表,本来用的别人写的发现不太够用索性自己写了。代码放我GitHub:https://github.com/xxxxxyn/vu...

先来个效果图
在这里插入图片描述
功能:

1.点击暂停(时间可设置)

2.鼠标悬浮暂停(也可以不暂停)

3.设置每行的列宽、文字对齐方式(列宽用什么单位都可以)

4.速度调节

5.点击事件获取该行数据

开始

npm i vue-carousel-list

或 or

yarn add vue-carousel-list

暂时只能按需引入,不能全局引入

import CarouselList from 'vue-carousel-list'
......
components:{
            CarouselList
        },

使用

//列表的数据,数组格式
//data of the list
:data="data"
//轮播的配置,详见例子
//config of carouselList, see example for detail
:config='config'
//example:
              data:[
                  ['a','b','c'],
                  ['a1','b1','c1'],
                  ['a2','b2','c2'],
                  ['a3','b3','c3']
              ],
              config:{
                  speed:1,//速度调节,越大越快--Number
                  clickStop:true//点击是否暂停--Boolean
                  clickStopTime:'4000',//点击暂停毫秒数--String
                  columnWidth:["10vw","50px","80px"],//各个列宽,要使用什么单位都行--Array
                  textAlign:["center","left","left"],//各列文字对齐方式--Array
speed:2,
                  hoverStop:true,//鼠标进入是否暂停
              },
//点击获取该行数据事件。接收的第一个参数就是点击行数据
@clickcurrent=''

!!!注意-Attention!!!

暂时不兼容IE。。。

评论

暂无评论