refs #7136 use paginate when url exists
gitea/salix-front/pipeline/pr-dev Build queued... Details

This commit is contained in:
Javier Segarra 2024-04-05 13:59:23 +02:00
parent 3159c1c049
commit 243d66b592
2 changed files with 40 additions and 44 deletions

View File

@ -60,7 +60,7 @@ const $props = defineProps({
}, },
limit: { limit: {
type: [Number, String], type: [Number, String],
default: '30', default: '4',
}, },
fetchRef: { fetchRef: {
type: Object, type: Object,
@ -165,11 +165,12 @@ async function onScroll(scrollEv) {
const lastIndex = myOptions.value.length - 1; const lastIndex = myOptions.value.length - 1;
const optionIndex = ref.getOptionIndex(); const optionIndex = ref.getOptionIndex();
if (!$props.fetchRef) return; if (!$props.url && !$props.fetchRef) return;
if (direction === 'decrease') return; if (direction === 'decrease') return;
if (optionIndex > 0 && to === lastIndex && isLoading.value === false) { if (optionIndex > 0 && to === lastIndex && isLoading.value === false) {
isLoading.value = true; isLoading.value = true;
await $props.fetchRef.paginate(); !$props.url && (await $props.fetchRef.paginate());
$props.url && (await dataRef.value.paginate());
} }
} }
</script> </script>

View File

@ -30,7 +30,6 @@ const suppliersRef = ref();
limit="30" limit="30"
auto-load auto-load
@on-fetch="(data) => (suppliers = data)" @on-fetch="(data) => (suppliers = data)"
auto-load
/> />
<VnFilterPanel :data-key="props.dataKey" :search-button="true"> <VnFilterPanel :data-key="props.dataKey" :search-button="true">
<template #tags="{ tag, formatFn }"> <template #tags="{ tag, formatFn }">
@ -72,11 +71,7 @@ const suppliersRef = ref();
</QItem> </QItem>
<QItem> <QItem>
<QItemSection> <QItemSection>
<VnInputDate <VnInputDate :label="t('From')" v-model="params.from" is-outlined />
:label="t('From')"
v-model="params.from"
is-outlined
/>
</QItemSection> </QItemSection>
</QItem> </QItem>
<QItem> <QItem>