Commit 98f5fbb5 authored by DPFly's avatar DPFly

优化滚动渐变虚拟导航栏,修复完全显示时滚动抖动问题

parent fb9f63a3
......@@ -71,15 +71,12 @@
})
},
onPageScroll(e) {
if (this.canUse['navigationStyle']){
if (this.canUse['navigationStyle']) {
let scrollTop = e.scrollTop > 0 ? e.scrollTop - this.statusBarHeight : 0
let isShowTitle = 1 - scrollTop * 0.01
if (isShowTitle < 0) {
isShowTitle = 0
}
if (isShowTitle > 1) {
isShowTitle = 1
}
let isShowTitle = Number((1 - scrollTop * 0.01).toFixed(2))
isShowTitle =
isShowTitle < 0 ? 0 : isShowTitle > 1 ? 1 : isShowTitle
if (this.isShowTitle === isShowTitle) return
this.isShowTitle = isShowTitle
}
},
......
......@@ -782,13 +782,10 @@
onPageScroll(e) {
if (this.canUse['navigationStyle']) {
let scrollTop = e.scrollTop > 0 ? e.scrollTop - this.statusBarHeight : 0
let isShowTitle = 1 - scrollTop * 0.01
if (isShowTitle < 0) {
isShowTitle = 0
}
if (isShowTitle > 1) {
isShowTitle = 1
}
let isShowTitle = Number((1 - scrollTop * 0.01).toFixed(2))
isShowTitle =
isShowTitle < 0 ? 0 : isShowTitle > 1 ? 1 : isShowTitle
if (this.isShowTitle === isShowTitle) return
this.isShowTitle = isShowTitle
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment