wechat-miniprogram / recycle-view

recycle-view: a wechat miniprogram custom component
MIT License
635 stars 72 forks source link

报错误 Cannot read property 'height' of null #71

Closed jk2K closed 3 years ago

jk2K commented 3 years ago

image

image

jk2K commented 3 years ago

解决, 不能使用 wx:if, recycle-view 必须一直存在,如果想实现显隐效果,应该用 hidden

错误

<view wx:if="{{isLoading}}">
  <mp-loading type="circle"></mp-loading>
</view>
<view wx:else class="info-list weui-cells">
  <recycle-view batch="{{batchSetRecycleData}}" id="recycleId" enable-back-to-top="true">
    <view slot="before"></view>
    <recycle-item wx:for="{{recycleList}}" wx:key="id">
    </recycle-item>
    <view slot="after">到底部了,不要再拉了</view>
  </recycle-view>
</view>

正确

<view hidden="{{!isLoading}}">
    <mp-loading type="circle"></mp-loading>
</view>
<view hidden="{{isLoading}}" class="info-list weui-cells">
  <recycle-view batch="{{batchSetRecycleData}}" id="recycleId" enable-back-to-top="true">
    <view slot="before"></view>
    <recycle-item wx:for="{{recycleList}}" wx:key="id">
    </recycle-item>
    <view slot="after">到底部了,不要再拉了</view>
  </recycle-view>
</view>
JeckChou commented 2 years ago

@jk2K 这个问题是只出现在Android吗?