vue获取滚动的scrollTop的值
mounted() {// let _this=thiswindow.addEventListener('scroll', () => {let top = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset...
·
mounted() {
// let _this=this
window.addEventListener('scroll', () => {
let top = document.documentElement.scrollTop || document.body.scrollTop || window.pageYOffset
console.log(top);
if (top > 700) {
this.scrollTag = true;
} else {
this.scrollTag = false
}
})
}
更多推荐
已为社区贡献20条内容
所有评论(0)