mounted() {
window.addEventListener("scroll", this.handleScroll, true);
},
handleScroll(e) {
console.log(e.target.scrollTop);
let top = e.target.scrollTop;
if (top > 176) {
this.earlyWarningName = "earlyWarningFixed";
} else {
this.earlyWarningName = "";
}
},
解决两个滚动条同时触发监听的效果:
if (e.target.offsetTop == 40) {
return;
}