动态绑定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>
如何解决使用`hidden`属性对`scroll-view`组件下拉刷新造成的影响?经过本人测试,在初始 `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` 来完成功能,请问各位大佬有什么好用的解决方案吗?
2020-06-18动态绑定refresher-enabled的值,就是切换的时候刷新一下refresher-enabled的值,可以与hidden的值相反,如题主的refresher-enabled="{{type !== 'list'}}"
用hidden切换地图和列表,scroll-view列表的下拉刷新失效。用hidden切换地图和列表,scroll-view列表的下拉刷新失效。 <!-- 正常 --> <!-- <view class="content" wx:if="{{type == 'list'}}"> <scroll-view scroll-y="true" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="refresh" > ....... </scroll-view> <!-- ---------------------------------------------------------------------------------------- --> <!-- 失效 --> <view class="content" hidden="{{type == 'list'? false: true}}"> <scroll-view scroll-y="true" refresher-enabled="{{true}}" refresher-triggered="{{triggered}}" bindrefresherrefresh="refresh"> ....... </scroll-view> </view>
2020-06-18