//这里的高度是我自定义减去导航栏高度,只要使用了{{titleHeight}},刷新就拉不下来,该怎么解决?求大佬告知
<scroll-view
scroll-y style="width: 100%; height: calc(100% - 88rpx - {{titleHeight}}px)"
refresher-enabled="{{true}}"
refresher-threshold="{{100}}"
refresher-default-style="white"
refresher-background="lightgreen"
refresher-triggered="{{triggered}}"
bindrefresherpulling="onPulling"
bindrefresherrefresh="onRefresh"
bindrefresherrestore="onRestore"
bindrefresherabort="onAbort"
>
<view wx:for="{{arr}}" style="display: flex; height: 100px;">
<image src="https://images.unsplash.com/photo-1565699894576-1710004524ba?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1832&q=80"></image>
<image src="https://images.unsplash.com/photo-1566402441483-c959946717ed?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1600&q=80"></image>
<image src="https://images.unsplash.com/photo-1566378955258-7633cb5c823e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=634&q=80"></image>
<image src="https://images.unsplash.com/photo-1566404394190-cda8c6209208?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=630&q=80"></image>
<image src="https://images.unsplash.com/photo-1566490595448-be523b4d2914?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=958&q=80"></image>
</view>
</scroll-view>
动态获取高度现在是无法下拉刷新的 所以在刚开始的时候要给一个默认值 例如: {{ titleHeight || 200}}px
或许楼主可以尝试,在scroll-view上添加wx:if的判断条件试试。比如
<scroll-view wx:if="{{show}}" style="height: {{height}}px" class="scroll" scroll-y="true" refresher-enabled="{{true}}" refresher-threshold="{{0}}" refresher-triggered="{{triggered}}" bindrefresherpulling="onPulling" bindrefresherrefresh="onRefresh" bindrefresherrestore="onRestore" bindrefresherabort="onAbort"> scroll内容 </scroll-view>
show的值在算出height的时候,置为true
是有这么个问题
替代解决方案是外面包一层然后设置scroll-view的height:100%固定死,然后设置top和margin-bottom来解决
<view class="Content-Box" style='top: 130rpx;margin-bottom:100rpx;'> <scroll-view scroll-y style="height: 100%">