vue獲取滾動的scrollTop的值
阿新 • • 發佈:2020-12-25
技術標籤:vue
mounted() { // let _this=this window.addEventListener('scroll', () => { let top = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset console.log(top); if (top > 700) { this.scrollTag = true; } else { this.scrollTag = false } }) }