Vue如何监听滚动条
export default {mounted() {window.addEventListener("scroll", this.handleScroll, true);},methods: {handleScroll(e) {let scrollTop =document.documentElement.scrollTop || document.body.scrollTop;console.
·
export default {
mounted() {
window.addEventListener("scroll", this.handleScroll, true);
},
methods: {
handleScroll(e) {
let scrollTop =
document.documentElement.scrollTop || document.body.scrollTop;
console.log(scrollTop);
},
},
};
</script>
更多推荐
已为社区贡献2条内容
所有评论(0)