0
0
Fork 0

fix(lilium) #7180 SupplierList Scroll

This commit is contained in:
Javier Segarra 2024-04-17 08:41:47 +02:00
parent 892c5986c0
commit 248416b676
2 changed files with 19 additions and 5 deletions

View File

@ -83,7 +83,12 @@ const store = arrayData.store;
onMounted(() => { onMounted(() => {
if (props.autoLoad) fetch(); if (props.autoLoad) fetch();
}); });
// watch(
// () => arrayData,
// () => {
// console.error(this);
// }
// );
watch( watch(
() => props.data, () => props.data,
() => { () => {
@ -127,7 +132,7 @@ async function paginate() {
} }
function endPagination() { function endPagination() {
hasMoreData.value = arrayData.hasMoreData.value; // hasMoreData.value = store.hasMoreData.value;
isLoading.value = false; isLoading.value = false;
emit('onFetch', store.data); emit('onFetch', store.data);
emit('onPaginate'); emit('onPaginate');
@ -183,11 +188,13 @@ defineExpose({ fetch, addFilter });
</QCard> </QCard>
</div> </div>
</div> </div>
<!-- <pre>hasMoreData*{{ hasMoreData }}</pre>
<pre>arrayData.hasMoreData**{{ arrayData.store.hasMoreData }}</pre> -->
<QInfiniteScroll <QInfiniteScroll
v-if="store.data" v-if="store.data"
@load="onLoad" @load="onLoad"
:offset="offset" :offset="offset"
:disable="disableInfiniteScroll || !arrayData.hasMoreData.value" :disable="disableInfiniteScroll || !arrayData.hasMoreData"
class="full-width" class="full-width"
v-bind="$attrs" v-bind="$attrs"
> >

View File

@ -20,6 +20,13 @@ export function useArrayData(key, userOptions) {
const page = ref(1); const page = ref(1);
// watch(
// () => store.hasMoreData,
// () => {
// hasMoreData.value = store.hasMoreData;
// arrayDataStore.$state.console.error(this);
// }
// );
onMounted(() => { onMounted(() => {
setOptions(); setOptions();
@ -98,7 +105,7 @@ export function useArrayData(key, userOptions) {
const { limit } = filter; const { limit } = filter;
hasMoreData.value = response.data.length >= limit; hasMoreData.value = response.data.length >= limit;
store.hasMoreData = hasMoreData.value;
if (append) { if (append) {
if (!store.data) store.data = []; if (!store.data) store.data = [];
for (const row of response.data) store.data.push(row); for (const row of response.data) store.data.push(row);
@ -169,7 +176,7 @@ export function useArrayData(key, userOptions) {
} }
async function loadMore() { async function loadMore() {
if (!hasMoreData.value) return; if (!hasMoreData.value && !store.hasMoreData) return;
store.skip = store.limit * page.value; store.skip = store.limit * page.value;
page.value += 1; page.value += 1;