var vm = new Vue({
el: "#app",
data: {
top:0,
bodyEl: document.body,
},
methods: {
stopBodyScroll: function(isFixed) {
if (isFixed) {
this.top = window.scrollY
this.bodyEl.style.position = 'fixed'
this.bodyEl.style.top = -this.top + 'px'
} else {
this.bodyEl.style.position = ''
this.bodyEl.style.top = ''
window.scrollTo(0, this.top) // 回到原先的top
}
}
}
mounted: function () {}
});
移动端滑动穿透问题
最新推荐文章于 2022-05-19 16:42:07 发布