<template>
<scroller ref="page">
<refresh class="refresh" @refresh="onrefresh" @pullingdown="onpullingdown"
:display="page_refreshing?'show':'hide'">
<loading-indicator color="#999"></loading-indicator>
</refresh>
<view>
<view class="container">
<view class="navbar-box" ref="navbar" style="position:sticky;height:88px;width:750rpx"></view>
</view>
</view>
</scroller>
</template>
onReady监听:
onReady() {
this.navbarHeight = plus.navigator.getStatusbarHeight() + (this.systemInfo.platform == "ios" ? 44 :
48)
let that = this
setTimeout(() => {
let navbar = that.getEl(this.$refs.navbar)
let page = that.getEl(this.$refs.page)
var gesTokenObj = BindingX.bind({
anchor: page,
eventType: 'scroll',
props: [{
element: navbar,
property: 'opacity',
expression: `1-(abs(y)/${that.navbarHeight})`
}]
}, function(e) {
console.log(e)
console.log("1",navbar)
console.log(that.$refs.container)
});
this.navbar_active = gesTokenObj.token;
}, 300)
},
Tshoiasc (作者)
谢谢回复。这个问题通过用bindingX的transform变着法的实现sticky逻辑的给强行解决了一下,现在看起来没什么大问题就是没具体测试性能。
2022-05-11 10:51