cwg-page-more-wrapper.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <template>
  2. <z-paging ref="paging" refresher-only @onRefresh="onRefresh" :pagingStyle="{ top: `${60 + statusBarHeight}px` }"
  3. :use-custom-refresher="true" refresher-default-text=" " refresher-pulling-text=" "
  4. refresher-refreshing-text=" ">
  5. <slot></slot>
  6. </z-paging>
  7. </template>
  8. <script setup>
  9. import zPaging from "@/uni_modules/z-paging/components/z-paging/z-paging.vue";
  10. import { computed, defineEmits, defineProps, ref } from 'vue'
  11. import useGlobalStore from '@/stores/use-global-store'
  12. import { useI18n } from 'vue-i18n';
  13. const { t } = useI18n();
  14. const globalStore = useGlobalStore()
  15. const statusBarHeight = computed(() => globalStore.statusBarHeight);
  16. const props = defineProps({
  17. lowerThreshold: { type: Number, default: 200 },
  18. loading: { type: Boolean, default: false },
  19. refresherEnabled: { type: Boolean, default: false },
  20. isScroll: { type: Boolean, default: true },
  21. height: { type: Number, default: 0 },
  22. })
  23. const emit = defineEmits(['reach-bottom', 'refresh'])
  24. const paging = ref(null)
  25. const refresherTriggered = ref(false)
  26. const onRefresh = () => {
  27. emit('refresh')
  28. }
  29. defineExpose({
  30. stopRefresh: () => {
  31. paging.value.complete();
  32. }
  33. })
  34. </script>
  35. <style scoped lang="scss">
  36. @import "@/uni.scss";
  37. .loadmore-wrapper {
  38. /* height: calc(100vh - var(--status-bar-height)); */
  39. width: 100%;
  40. box-sizing: border-box;
  41. }
  42. .loading {
  43. text-align: center;
  44. padding: px2rpx(20);
  45. color: #888;
  46. }
  47. </style>