vue 监听某个div垂直滚动条下拉到底部的方法
发布时间:2020-12-16 23:34:14 所属栏目:百科 来源:网络整理
导读:如下所示: {const el = document.querySelector('.act-not');const offsetHeight = el.offsetHeight;el.onscroll = () => {const scrollTop = el.scrollTop;const scrollHeight = el.scrollHeight;if ((offsetHeight + scrollTop) - scrollHeight >= -1) {/
如下所示: {
const el = document.querySelector('.act-not');
const offsetHeight = el.offsetHeight;
el.onscroll = () => {
const scrollTop = el.scrollTop;
const scrollHeight = el.scrollHeight;
if ((offsetHeight + scrollTop) - scrollHeight >= -1) {
// 需要执行的代码
}
};
});
坑:在做滚动加载分页时候,有时候第三方的弹窗如elementui 会出问题 ,这时候需要watch变量弹窗关闭时修改el.scrollTop=0即可。以上这篇vue 监听某个div垂直滚动条下拉到底部的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |