vue3-infinite-loading icon indicating copy to clipboard operation
vue3-infinite-loading copied to clipboard

Manually trigger infinite

Open timoteiNicsoft opened this issue 1 year ago • 6 comments

I'm working in Vue 3, and I'm trying to manually trigger the infinite scroll because on small screens, the loader is larger than the screen, so the infinite scroll doesn't render only when scrolling down to the bottom of the page.

I've tried this:

<InfiniteLoading :identifier="infiniteId" @infinite="infiniteProceduresHandler" :firstload="false" ref="infiniteLoadingRef">
     <template #complete><span></span></template>
     <template #spinner><span></span></template>
</InfiniteLoading>

<script setup lang="ts">

onMounted(async () => {
         await nextTick(() => {
             infiniteLoadingRef.value?.$emit('infinite', infiniteLoadingRef.value.stateChanger);
         });
});
</script>

the problem is that in the infiniteProceduresHandler function it does not recognize $state.

timoteiNicsoft avatar Apr 03 '24 08:04 timoteiNicsoft

Hi,

I tried using infiniteLoadingRef.value.$emit('infinite') but I still get the same error. It shows that it doesn’t recognize $state.

timoteiNicsoft avatar Jun 07 '24 08:06 timoteiNicsoft

@timoteiNicsoft hey, I deleted my answer because it wasn't working correctly. You can save the state from the initial load function but then it will stop working once you do that if you use the complete command, then it won't load anymore.

jTiKey avatar Jun 07 '24 08:06 jTiKey

But I don’t have the initial state because, on small screens, the loader template is larger than the page, and I need to trigger it manually; otherwise, the loader stays on the entire page.

It used to work before, but now, with the Vue 3 version, it no longer works.

timoteiNicsoft avatar Jun 07 '24 08:06 timoteiNicsoft

vuetify has an infinite scroller that has a manual mode, you could try that one.

jTiKey avatar Jun 07 '24 08:06 jTiKey