index.jsx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import React,{Component} from 'react';
  2. import {Image, View} from '@tarojs/components';
  3. import {AtActivityIndicator, AtPagination} from 'taro-ui';
  4. import 'taro-ui/dist/style/components/icon.scss';
  5. import 'taro-ui/dist/style/components/divider.scss';
  6. import 'taro-ui/dist/style/components/icon.scss';
  7. import './index.less';
  8. import noData from '../../../image/noData.png';
  9. import 'taro-ui/dist/style/components/activity-indicator.scss';
  10. import 'taro-ui/dist/style/components/loading.scss';
  11. import 'taro-ui/dist/style/components/pagination.scss';
  12. import 'taro-ui/dist/style/components/button.scss';
  13. import 'taro-ui/dist/style/components/icon.scss';
  14. class ListBottomStart extends Component{
  15. constructor(props) {
  16. super(props);
  17. }
  18. render() {
  19. const { state } = this.props;
  20. return (
  21. this.props.type === 'pagination' ? <View className='listBottomStartComponent'>
  22. {
  23. state === 'RELOAD' ?
  24. <View className='reload'>
  25. <View>加载失败</View>
  26. <View className='operation' onClick={()=>{
  27. this.props.reload && this.props.reload();
  28. }}>点击重新加载</View>
  29. </View>:
  30. state === 'NO_DATA' ?
  31. <View className='noData'>
  32. <Image src={noData} className='noDataImg'/>
  33. <View className='noDataTitle'>暂时没有数据</View>
  34. </View>
  35. : <AtPagination
  36. icon
  37. total={this.props.total}
  38. pageSize={this.props.pageSize}
  39. current={this.props.current}
  40. onPageChange={v=>{
  41. this.props.onPageChange(v.type, v.current)
  42. }}
  43. />
  44. }
  45. </View> :<View className='listBottomStartComponent'>
  46. {
  47. state === 'NO_MORE_DATA' ?
  48. <View className='noMoreData'>
  49. 没有更多了
  50. </View>:
  51. state === 'RELOAD' ?
  52. <View className='reload'>
  53. <View>加载失败</View>
  54. <View className='operation' onClick={()=>{
  55. this.props.reload && this.props.reload();
  56. }}>点击重新加载</View>
  57. </View>:
  58. state === 'LOADING' ?
  59. <View>
  60. <AtActivityIndicator content='加载中...'/>
  61. </View>:
  62. state === 'NO_DATA' ?
  63. <View className='noData'>
  64. <Image src={noData} className='noDataImg'/>
  65. <View className='noDataTitle'>暂时没有数据</View>
  66. </View>
  67. : null
  68. }
  69. </View>
  70. )
  71. }
  72. }
  73. export default ListBottomStart;