html
<ul style="margin: 0; padding: 0" id="ul_first">
<li
class="totalInfo"
v-for="(item, index) in chartDatas.monitor.data"
:key="index"
>
<div class="li-item name-box">
<p>数据名称</p>
<p>{{ item.filename }}</p>
</div>
<div class="li-item value-box">
<p>接入时间</p>
<p class="value">{{ item.upload_time }}</p>
</div>
</li>
</ul>
方法:
<script>
iniftySroll() {
let moveup = () => {
let parent = document.getElementById("ul_first");
// var scollT=document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
let boxlist = document.getElementsByClassName("totalInfo")[0];
if (parent.scrollTop >= parent.offsetHeight * 0.33) {
let box = document.getElementsByClassName("totalInfo")[0];
let box1 = document.getElementsByClassName("totalInfo")[0];
box.parentNode.removeChild(box);
parent.appendChild(box1);
} else {
parent.scrollTop++;
}
};
let dom = document.getElementById("ul_first");
// var timer = (_this.chartDatas.monitor.timer = setInterval(moveup, 100));
this.chartDatas.monitor.timer = setInterval(moveup, 100);
dom.addEventListener("mouseover", () => {
clearInterval(this.chartDatas.monitor.timer);
});
dom.addEventListener("mouseout", () => {
clearInterval(this.chartDatas.monitor.timer);
this.chartDatas.monitor.timer = setInterval(moveup, 100);
});
},
</script>