import { Text, View } from '@tarojs/components' import type { FC } from 'react' import Iconfont from '../iconfont/iconfont' import LoadingCard from '../loadingCard/index' import styles from './index.module.scss' export type LoadMoreStatus = 'more' | 'loading' | 'noMore' | 'empty' interface LoadMoreEvent { onClick?: () => void } interface LoadMorePropsType extends LoadMoreEvent { status: LoadMoreStatus moreText?: string loadingText?: string noMoreText?: string emptyText?: string } const LoadMore: FC = (props) => { const { status, moreText = '查看更多', loadingText = '加载中', noMoreText = '没有更多', emptyText = '暂无数据', onClick } = props const handleShowMore = () => { onClick && onClick() } let component: JSX.Element | null = null if (status === 'loading') { component = } else if (status === 'more') { component = ( {moreText} ) } else if (status === 'empty') { component = ( {emptyText} ) } else { component = {noMoreText} } return {component} } export default LoadMore