import { List, Loading } from '@taroify/core'; import { ReactNode } from 'react'; import './index.less'; interface IPlaceholderProps { hasMore: boolean; loadingMore: boolean; loadMoreError: boolean; noMoreText: ReactNode; loadMoreErrorText: ReactNode; } function ListPlaceholder(props: Partial) { const { hasMore, loadingMore, loadMoreError, noMoreText, loadMoreErrorText } = props; let content: ReactNode = ''; if (loadingMore) { content = 加载中...; } else if (loadMoreError) { content = loadMoreErrorText ?? '加载失败,请下拉刷新重试'; } else if (!hasMore) { content = noMoreText ?? '没有更多了'; } if (!content) { return null; } return {content}; } export default ListPlaceholder;