index.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <template>
  2. <view class="list-page">
  3. <up-list @scrolltolower="scrolltolower" style="height: 100%;" v-if="type === 'ordinary'">
  4. <up-list-item v-for="(item, index) in data" :key="index" >
  5. <ListItem :data="item" />
  6. </up-list-item>
  7. <up-loadmore
  8. :line="true"
  9. status="nomore"
  10. ></up-loadmore>
  11. </up-list>
  12. <up-list @scrolltolower="scrolltolower" style="height: 100%;" v-else>
  13. <up-list-item v-for="(item, index) in data" :key="index" >
  14. <RankingItem :data="item" />
  15. </up-list-item>
  16. <up-loadmore
  17. :line="true"
  18. status="nomore"
  19. ></up-loadmore>
  20. </up-list>
  21. </view>
  22. </template>
  23. <script setup>
  24. import ListItem from './listItem.vue';
  25. import RankingItem from './rankingItem.vue';
  26. const props = defineProps({
  27. data: {
  28. type: Array,
  29. default: [],
  30. },
  31. type: {
  32. type: String,
  33. default: 'ordinary' , // ordinary: 普通 ranking: 排行
  34. }
  35. });
  36. const emit = defineEmits(['refresh']);
  37. const scrolltolower = () => {
  38. console.log('底部');
  39. // emit('refresh');
  40. };
  41. </script>
  42. <style lang="scss" scoped>
  43. .list-page {
  44. background: rgba(245, 245, 245, 1);
  45. padding: 12px;
  46. height: 100%;
  47. overflow-y: auto;
  48. .item {
  49. height: 120px;
  50. border-radius: 10px;
  51. background: rgba(255, 255, 255, 1);
  52. padding: 12px;
  53. }
  54. }
  55. </style>