index.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 { ref, reactive } from 'vue';
  25. import { onLoad, onShow } from '@dcloudio/uni-app';
  26. import ListItem from './listItem.vue';
  27. import RankingItem from './rankingItem.vue';
  28. const props = defineProps({
  29. data: {
  30. type: Array,
  31. default: [],
  32. },
  33. type: {
  34. type: String,
  35. default: 'ordinary' , // ordinary: 普通 ranking: 排行
  36. }
  37. });
  38. const emit = defineEmits(['refresh']);
  39. const scrolltolower = () => {
  40. console.log('底部');
  41. // emit('refresh');
  42. };
  43. </script>
  44. <style lang="scss" scoped>
  45. .list-page {
  46. background: rgba(245, 245, 245, 1);
  47. padding: 12px;
  48. height: 100%;
  49. overflow-y: auto;
  50. .item {
  51. height: 120px;
  52. border-radius: 10px;
  53. background: rgba(255, 255, 255, 1);
  54. padding: 12px;
  55. }
  56. }
  57. </style>