赞
踩
直接在需要监听的页面最外层div加监听事件
- <template>
- <div class="contain" @scroll="onScroll">
-
- </div>
- </template>
-
- methods:{
-
- onScroll(e){
-
- let scrollTop = e.target.scrollTop;
- let scrollHeight = e.target.scrollHeight;
- let offsetHeight = Math.ceil(e.target.getBoundingClientRect().height);
- let currentHeight = scrollTop + offsetHeight;
- if (currentHeight >= scrollHeight) {
- console.log('触底了')
- }
-
- }
-
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。