How does vue monitor how the page scrolls to a certain height to trigger events
This article mainly explains "how vue monitors the page to scroll to a certain highly triggered event." Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let Xiaobian take you to learn "how vue monitors the page to scroll to a certain height trigger event"!
Scrolling to a high trigger event methods: { showIcon() { if ( !! document.documentElement.scrollTop && document.documentElement.scrollTop > 200 ) { Page height greater than 200 Perform operation } else { Page height is less than 200 } },}
surveillance incident
mounted() { window.addEventListener("scroll", this.showIcon);}, dynamically listen to page scroll height//get page scroll height methods:{ scrollHandle(e){ let top = e.srcElement.scrollingElement.scrollTop; //Get page scroll height console.log(top); }}mounted(){ window.addEventListener ('scroll ',this.scrollHandle);//bind page scroll events }, At this point, I believe that everyone has a deeper understanding of "how vue monitors page scrolling to a certain height trigger event", so let's actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!