vue触底加载

mac2024-05-16  30

触底加载

mounted(){ window.addEventListener('scroll', this.getbottom) }, methods: { ...mapMutations(['jcom_dyn_details', 'clearjcom']), getbottom(){ let scrollTop = document.documentElement.scrollTop || document.body.scrollTop; let clientHeight = document.documentElement.clientHeight || document.body.clientHeight; let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; let numHeight = scrollTop + clientHeight; if(scrollHeight > clientHeight && numHeight > scrollHeight - 1){ console.log(1) } // $(window).scroll(()=>{ // var scrollTop = $(window).scrollTop(); // var scrollHeight = $(document).height(); // var windowHeight = $(window).height(); // if (scrollTop + windowHeight == scrollHeight) { // console.log(1) // } // }); }, }
最新回复(0)