onLoad() {
let that = this
// 获取当前dom与顶部之间的距离
const query = uni.createSelectorQuery()
query.select('#delicacy').boundingClientRect()
query.exec(function(res){
that.menuTop = res[0].top
})
},
// 监听滚动
onPageScroll(e) {
this.rect = e.scrollTop
if(this.rect > this.menuTop) {
this.isFiexd = true
} else {
console.log('buzhiding')
this.isFiexd = false
}
console.log(e.scrollTop)
},
uniapp下拉置顶
最新推荐文章于 2024-07-26 20:46:33 发布