diff --git a/src/components/ui/VnPaginate.vue b/src/components/ui/VnPaginate.vue index 4c38c1c1a..24944e322 100644 --- a/src/components/ui/VnPaginate.vue +++ b/src/components/ui/VnPaginate.vue @@ -44,7 +44,7 @@ const props = defineProps({ }, offset: { type: Number, - default: 500, + default: 0, }, skeleton: { type: Boolean, @@ -54,6 +54,10 @@ const props = defineProps({ type: Function, default: null, }, + disableInfiniteScroll: { + type: Boolean, + default: false, + }, }); const emit = defineEmits(['onFetch', 'onPaginate']); @@ -122,10 +126,11 @@ async function paginate() { emit('onPaginate'); } -async function onLoad(...params) { - if (!store.data) return; +async function onLoad(index, done) { + if (!store.data) { + return done(); + } - const done = params[1]; if (store.data.length === 0 || !props.url) return done(false); pagination.value.page = pagination.value.page + 1; @@ -174,7 +179,8 @@ async function onLoad(...params) { v-if="store.data" @load="onLoad" :offset="offset" - class="full-width full-height" + :disable="disableInfiniteScroll || !arrayData.hasMoreData.value" + class="full-width" >