vue无缝滑动,鼠标移上则停止离开滑动
方法:http://www.mamicode.com/info-detail-2793573.html
<div class="scroll-up" ref="scroll" @mouseover="stopScroll" @mouseleave="startScroll">
<p v-for="(item,index) in testData" :key="index" class="qq2">{
{ item.Title }}</p>
</div>
data() {
return {
testData: [], //自己获取
scrollArea: "",
speed: 20,
timer: null,
delay: 20,
pHeight: "",
};
}
//方法
stopScroll() {
clearInterval(this.timer);
},
startScroll() {
this.timer = setInterval(this.scrollUp, this.speed);
this.scrollArea.scrollTop++;
},
scrollUp() {
if (this.scrollArea.scrollTop % this.pHeight =