SelfList.vue 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <script setup>
  2. /**
  3. * 公共列表组件
  4. */
  5. const props=defineProps({
  6. count:0,//当前加载的列表数据数量
  7. loading:false,
  8. finished:false,//是否加载完
  9. isEmpty:false,//是否为空数据
  10. emptyMsg:{
  11. type:String,
  12. default:'暂无数据'
  13. },//为空时描述文字
  14. })
  15. const emit=defineEmits(['listOnload'])
  16. const handleClickLoadMore=()=>{
  17. emit('listOnload')
  18. }
  19. </script>
  20. <template>
  21. <div class="self-list-wrap">
  22. <slot></slot>
  23. <div class="empty-box" v-if="props.isEmpty">
  24. <img :src="$store.state.globalImgUrls.chartEmpty" alt="">
  25. <p>{{props.emptyMsg}}</p>
  26. </div>
  27. <div class="bot-load" v-if="!props.finished&&!props.loading&&!props.isEmpty">
  28. <div class="btn" @click="handleClickLoadMore">加载更多</div>
  29. </div>
  30. <div class="bot-load" v-if="!props.finished&&props.loading">
  31. <div class="loading-text">加载中...</div>
  32. </div>
  33. <p class="nomore-text" v-if="!props.isEmpty&&props.finished&&props.count>20">没有更多了~</p>
  34. </div>
  35. </template>
  36. <style lang="scss" scoped>
  37. .self-list-wrap{
  38. .empty-box{
  39. padding-top: 100px;
  40. text-align: center;
  41. // color: #F3A52F;
  42. img{
  43. width: 200px;
  44. }
  45. }
  46. .bot-load{
  47. .btn{
  48. margin: 20px auto;
  49. width: 112px;
  50. height: 30px;
  51. background: #FFFFFF;
  52. border-radius: 20px;
  53. border: 1px solid #F3A52F;
  54. color: #F3A52F;
  55. font-size: 14px;
  56. text-align: center;
  57. line-height: 30px;
  58. cursor: pointer;
  59. }
  60. .loading-text{
  61. margin: 20px auto;
  62. text-align: center;
  63. color: #666;
  64. height: 30px;
  65. }
  66. }
  67. .nomore-text{
  68. text-align: center;
  69. color: #999;
  70. }
  71. }
  72. </style>