import { PureComponent } from 'react'
import { View, Image } from '@tarojs/components'
import { CDN } from '../../constants/api'
import './index.less'


type Props = {
  showIcon: boolean
  showTitle: boolean
}
type State = {

}

export default class Loading extends PureComponent<Props, State> {

  interval: any = null;

  static defaultProps: Props = {
    showIcon: true,
    showTitle: true
  }

  constructor (props) {
    super(props)
    this.state = {

    }
  }

  componentDidMount() {

  }

  componentWillUnmount() {

  }

  render () {
    const { showTitle} = this.props;

    return (
      <View className='loading'>
        <Image src={`${CDN}/common/loading.gif`} className={showTitle ? 'loading-pic' : 'loading-pic-small'}></Image>
        { showTitle && <View className='title'>加载中…</View> }
      </View>
    )
  }
}
