今天下午写的一个阅读app的用户页面,用betterscroll优化滚动之后发现下拉页面弹回之后顶部就会自动吞掉20px的空间,在别的页面没有出现过这种状况,这个初始化滚动的代码也是从别的页面直接拷过来的
这是最外层固定高度div的css样式代码,模拟设备规格是360*640,底部导航高度是50px
.mine
position: absolute
top: 0px
left: 0px
box-sizing: border-box
background: white
height: 590px
width: 100%
overflow: hidden
这是scroll的初始化代码
created() {
this._initScroll()
},
methods: {
_initScroll() {
this.$nextTick(() => {
if (!this.scroll) {
this.scroll = new BScroll(this.$refs.mine, {
click: true
})
} else {
this.scroll.refresh()
}
})
}
}
这样试一下