本文實(shí)例為大家分享了Vue組件實(shí)現(xiàn)觸底判斷的具體代碼,供大家參考,具體內(nèi)容如下
非常簡(jiǎn)陋的代碼,以后有空回來(lái)完善
子組件代碼:
<template> <div class="scroll"></div> </template> <script> export default { name:'Scroll', methods:{ scrollEvent(){ if (document.documentElement.scrollTop + document.documentElement.clientHeight >= document.body.scrollHeight) { this.onBottom(); } } }, props:{ onBottom:Function }, mounted(){ window.addEventListener('scroll', this.scrollEvent,false); }, destroyed () { window.removeEventListener('scroll', this.scrollEvent,false); } } </script>
新聞標(biāo)題:Vue組件實(shí)現(xiàn)觸底判斷-創(chuàng)新互聯(lián)
網(wǎng)站地址:http://www.chinadenli.net/article20/dhcojo.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、域名注冊(cè)、網(wǎng)站收錄、ChatGPT、企業(yè)網(wǎng)站制作、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容