✨ feat(邀请码): 完成邀请码模块

This commit is contained in:
xuan
2022-12-01 13:54:05 +08:00
parent 3ff32ee209
commit 7d3f6e22c5
19 changed files with 606 additions and 36 deletions
+14 -6
View File
@@ -26,10 +26,15 @@ export interface TablePropsType {
dataSource?: { list: RecordType[]; total: number }
onLoadMore?: () => void
height?: number
moreText?: string
loadingText?: string
noMoreText?: string
emptyText?: string
safeAreaInsetBottom?: boolean
}
const Table: FC<TablePropsType> = (props) => {
const { columns, dataSource, onLoadMore, height = 400 } = props
const { columns, dataSource, onLoadMore, height = 400, moreText = '查看更多', loadingText = '加载中', noMoreText = '没有更多了', emptyText = '暂无数据', safeAreaInsetBottom = true } = props
const handleShowMore = () => {
onLoadMore && onLoadMore()
@@ -54,15 +59,18 @@ const Table: FC<TablePropsType> = (props) => {
const loadMoreComponent = useMemo(() => {
if (dataSource) {
if (dataSource.list.length < dataSource.total) {
return <LoadMore status="more" onClick={handleShowMore}></LoadMore>
if (dataSource.list.length === 0 && dataSource.list.length === dataSource.total) {
return <LoadMore emptyText={emptyText} status="empty"></LoadMore>
}
else if (dataSource.list.length < dataSource.total) {
return <LoadMore moreText={moreText} status="more" onClick={handleShowMore}></LoadMore>
}
else if (dataSource.list.length >= dataSource.total) {
return <LoadMore status="noMore" onClick={handleShowMore}></LoadMore>
return <LoadMore noMoreText={noMoreText} status="noMore"></LoadMore>
}
}
else {
return <LoadMore status="loading" onClick={handleShowMore}></LoadMore>
return <LoadMore moreText={moreText} loadingText={loadingText} noMoreText={noMoreText} status="loading"></LoadMore>
}
}, [dataSource])
@@ -111,7 +119,7 @@ const Table: FC<TablePropsType> = (props) => {
)
})}
</View>
<InfiniteScroll enableLoadMoreStatus={false} safeAreaInsetBottom>
<InfiniteScroll enableLoadMoreStatus={false} safeAreaInsetBottom={safeAreaInsetBottom}>
{sourceContainer()}
</InfiniteScroll>
</View>