import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import { AtActivityIndicator } from 'taro-ui'
import './index.scss'
export default class ListMore extends Component {
  constructor (props) {
    super(props)
    this.state = {
      test: ''
    }
  }

  render () {
    const { isListEnd, isListLoading, isListEmpty, isOther, text } = this.props
    const emptyText = text || '暂无数据~'
    const bgEmpty = require('@img/ex_empty.png')
    return (
      <View className="l-scroll-more">
        {
          isOther
          &&
          <View className="lsm-empty xs">
            <Image className="lsme-img" src={bgEmpty}></Image>
            <View className="lsme-text">{emptyText}</View>
          </View>
        }
        {
          isListEmpty
          &&
          <View className="lsm-empty">
            <Image className="lsme-img" src={bgEmpty}></Image>
            <View className="lsme-text">{emptyText}</View>
          </View>
        }
        {
          isListEnd || isListLoading
          ?
          <View className="lsm-footer">
            {isListEnd && <View className="lsmf-text">没有更多数据~</View>}
            {isListLoading && <AtActivityIndicator mode='center' content='加载中...'></AtActivityIndicator>}
          </View>
          : ''
        }
      </View>
    )
  }
}