超出高度滚动
<div class="response_action response_action_scroll" @mouseover="mouseOverHandler" @mouseout="mouseoutHandler">
// 内容区
</div>
data() {
return {
activeInterval: null,
netCarCurrentScollTop: 0,
}
}
,
beforeDestroy () {
this.activeInterval && clearInterval(this.activeInterval )
},
methods: {
// 自动滚动
tableInfo: function() {
this.activeInterval && clearInterval(this.activeInterval)
let alarmInfoDom = document.getElementsByClassName('response_action_scroll')[0]
if (alarmInfoDom) {
this.activeInterval = setInterval(() => {
alarmInfoDom.scrollTop = this.netCarCurrentScollTop
// 到达底部判断
if (alarmInfoDom.scrollTop >= alarmInfoDom.scrollHeight - alarmInfoDom.offsetHeight) {
alarmInfoDom.scrollTop = 0
} else {
alarmInfoDom.scrollTop += 2
}
this.netCarCurrentScollTop = alarmInfoDom.scrollTop
}, 160)
}
},
mouseOverHandler() {
this.activeInterval && clearInterval(this.activeInterval)
},
mouseoutHandler() {
this.tableInfo()
}
}