收藏
回答

scroll-view使用了动态高度,自定义刷新拉不下来?

//这里的高度是我自定义减去导航栏高度,只要使用了{{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>
回答关注问题邀请回答
收藏

3 个回答

  • Mature.
    Mature.
    2020-08-24

    动态获取高度现在是无法下拉刷新的 所以在刚开始的时候要给一个默认值 例如: {{ titleHeight || 200}}px

    2020-08-24
    有用 1
    回复
  • 吕
    2020-07-01

    或许楼主可以尝试,在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


    2020-07-01
    有用
    回复
  • Admin ²º²⁴
    Admin ²º²⁴
    2020-04-09

    是有这么个问题

    替代解决方案是外面包一层然后设置scroll-view的height:100%固定死,然后设置top和margin-bottom来解决

        <view class="Content-Box" style='top: 130rpx;margin-bottom:100rpx;'>
          <scroll-view scroll-y style="height: 100%">
    
    
    2020-04-09
    有用
    回复
登录 后发表内容
问题标签