根据上篇文章,扩展监听功能
//监听页面 滚轮事件
handleScroll() {
const scrollTop = this.$refs.app.scrollTop
if (scrollTop > 850 && scrollTop < 950) {
this.is_index = 1
}
else if (scrollTop > 1790 && scrollTop < 1850) {
this.is_index = 2
}
else if (scrollTop > 3055) {
this.is_index = 3
}
else if (scrollTop < 500) {
this.is_index = 0
}
},
//页面div
<div class="right_div" ref="app" @scroll="handleScroll">
<!-- rsuOnline 组件 -->
<div id="rsuOnline">
<rsuOnline />
</div>
<!-- obuOnline 组件 -->
<div id="obuOnline">
<obuOnline />
</div>
<!-- rsuMalfunction 组件 -->
<div id="rsuMalfunction">
<rsuMalfunction />
</div>
<!-- obuMalfunction 组件 -->
<div id="obuMalfunction">
<obuMalfunction />
</div>
</div>