今天使用listView的時候發現頁面此時的下拉刷新屬性,只能往下滾動,當手指觸摸屏幕往上滾動的時候,頁面沒有任何的反應。。。也就是只能往下滾動不能往上滾動,對於經常使用ListView的情況下,我沒有發現寫法有任何的錯誤。
於是開始往其他頁面進行查找錯誤,發現使用l antd-mobile的<TabBar />組件。
發現在使用多頁面的時候,antd-mobile的例子中,有一個屬性,是我的頁面中所沒有的:prerenderingSiblingsNumber
把這個屬性添加到頁面上,所有的問題都解決了。。。
<TabBar
tintColor="#FE7100"
tabBarPosition="bottom"
prerenderingSiblingsNumber={0}
>
{tabBras.map((item) => (
<TabBar.Item
icon={
<div
style={{
width: '22px',
height: '22px',
background: `url(${item.icon}) center center / 21px 21px no-repeat`,
}}
/>
}
selectedIcon={
<div
style={{
width: '22px',
height: '22px',
background: `url(${item.selectedIcon}) center center / 21px 21px no-repeat`,
}}
/>
}
badge={item.badgeNum ? <span>{beyondNum(item.badgeNum)}</span> : null}
title={item.title}
key={item.key}
selected={selectedTab === item.key}
onPress={() => pressHandle(item.key)}
>
{renderContent(item.key)}
</TabBar.Item>
))}
</TabBar>