经过本人测试,在初始 `active` 值为 `i` ( i = 0,1,2 )的情况下, `refresher` 仅对 `i`号组件有效,其他组件将无法触发下拉刷新。
代码片段:
<view hidden="{{active !== 0}}">
<scroll-view refresher-enabled>0号组件</scroll-view>
</view>
<view hidden="{{active !== 1}}">
<scroll-view refresher-enabled>1号组件</scroll-view>
</view>
<view hidden="{{active !== 2}}">
<scroll-view refresher-enabled>2号组件</scroll-view>
</view>
如果替换使用了 `wx:if` ,则不会出现上述问题。
代码片段:
<view wx:if="{{active === 0}}">
<scroll-view refresher-enabled>0号组件</scroll-view>
</view>
<view wx:if="{{active === 1}}">
<scroll-view refresher-enabled>1号组件</scroll-view>
</view>
<view wx:if="{{active === 2}}">
<scroll-view refresher-enabled>2号组件</scroll-view>
</view>
需求使我更需要 `hidden` 来完成功能,请问各位大佬有什么好用的解决方案吗?
动态绑定refresher-enabled的值,就是切换的时候刷新一下refresher-enabled的值,可以取hidden相反的值,如
<view hidden="{{active !== 0}}"> <scroll-view refresher-enabled="{{active === 0}}">0号组件</scroll-view> </view> <view hidden="{{active !== 1}}"> <scroll-view refresher-enabled="{{active === 1}}">1号组件</scroll-view> </view> <view hidden="{{active !== 2}}"> <scroll-view refresher-enabled="{{active === 2}}">2号组件</scroll-view> </view>
我寻思你这两段代码逻辑都不对等啊
一个是‘!===’ 一个是‘===’
版本库多少