优化滚动

This commit is contained in:
2022-05-20 20:32:39 +08:00
parent f30e174e3e
commit 8112d38499
21 changed files with 240 additions and 144 deletions
+24 -14
View File
@@ -4,12 +4,14 @@ import style from "./index.module.scss"
import DotLoading from "@/components/dotLoading"
import LoadingCard from "../loadingCard"
export type StatusParam = 0|1|2|3
type Params = {
styleObj?: Object,
selfonScrollToLower?: () => void,
hasMore?: false|true,
hasMore?: false|true,
moreStatus?: false|true,
statusMore?: 0|1|2, //0:没数据加载,1:下拉加载,2:没有数据
statusMore?: StatusParam //0:数据从无到有加载数据,1,没有任何数据, 2:下拉加载,3:下拉没有数据
children?: ReactNode,
lowerThresholdNum?: number,
selfOnScrollToUpper?:() => void
@@ -80,20 +82,28 @@ export default memo(({
onRefresherAbort = {() => refresherAbort()}
refresherBackground ='#F8F8F8'
>
{(statusMore != 0)&&<View style={{paddingBottom:paddingBottom + 'rpx'}} className={style.scrollViewCon}>
{children}
{moreStatus&&<View className={style.infinite_scroll}>
{
hasMore&&<View className={style.loading_more}>加载中<DotLoading/></View>||
<View>没有更多数据了</View>
}
</View>}
</View>||
<LoadingCard/>
}
{!moreStatus&&<>
<View style={{paddingBottom:paddingBottom + 'rpx'}} className={style.scrollViewCon}>
{children}
</View>
</>||
<>
{(statusMore == 2 || statusMore == 3)&&<View style={{paddingBottom:paddingBottom + 'rpx'}} className={style.scrollViewCon}>
{children}
<View className={style.infinite_scroll}>
{
(statusMore == 2)&&<View className={style.loading_more}>加载中<DotLoading/></View>||
<View>没有更多数据了</View>
}
</View>
</View>
}
{(statusMore == 0)&&<LoadingCard/>}
{(statusMore == 1)&&<LoadingCard loadingIcon={false} title="暂无数据"/>}
</>}
<View className="common_safe_area_y"></View>
</ScrollView>
</>
)
})