vue插件 vue-seamless-scroll 无缝滚动
官网
https://chenxuan1993.gitee.io/component-document/index_prod#/component/seamless-default
安装
npm install vue-seamless-scroll --save
引入
import vueSeamlessScroll from ‘vue-seamless-scroll’
配置
components:{
vueSeamlessScroll
}
html:
<vueSeamlessScroll :data="listData" :class-option="classOption" class="seamless-warp">
<ul class="item">
<li v-for="item in listData">
<span class="title" v-text="item.title"></span><span class="date" v-text="item.date"></span>
</li>
</ul>
</vueSeamlessScroll>
js:
computed:{
classOption() {
return {
step:0.2,//数值越大滚动越快
direction: 2,//滚动方向:0:向下,1:向上,2:向左,3:向右
limitMoveNum: 100,//数据量:listData.length
hoverStop:true,//是否开启鼠标悬停stop
openWatch:true,//开启数据时监控刷新dom
singleHeight: 0, // 单步运动停止的高度(默认值0是无缝不停止的滚动) direction => 0/1
singleWidth:0,// 单步运动停止的宽度(默认值0是无缝不停止的滚动) direction => 2/3
waitTime:1000// 单步运动停止的时间(默认值1000ms)
}
}
}
data(){
return{
listData: [
{'title': 'A simple, seamless scrolling for Vue.js'},
{'title': 'A curated list of awesome things related to Vue.js'}
]
}
}
style:
.seamless-warp2 {
overflow: hidden;
height: 25px;
width: 380px;
ul.item {
width: 580px;
li {
float: left;
margin-right: 10px;
}
}
}