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

Manual trigger

Open kilkujadek opened this issue 4 years ago • 2 comments

First of all, thanks for great plugin!

I'm using it with containers which have various height. Occasionally they are much longer than window height and I would allow to navigate to top of container with keyboard shortcut. But there is nothing loaded yet. this.$refs.infiniteLoading.attemptLoad(); doesn't seems to work if article is long.

Is there any other way to manually force loading more?

kilkujadek avatar Dec 20 '20 17:12 kilkujadek

Calling attemptLoad won't work because it checks if the distance from the top of the component to the bottom of the scroll container is less than the minimum (https://github.com/PeachScript/vue-infinite-loading/blob/master/src/components/InfiniteLoading.vue#L262).

The existing API doesn't expose a way to do this, but you can force the functionality like this:

this.$refs.infiniteLoading.status = 1
this.$refs.infiniteLoading.$emit('infinite', this.$refs.infiniteLoading.stateChanger)

If you think this would be a valuable feature, it looks like it would be a simple change to make a PR for.

nVitius avatar Jan 01 '21 06:01 nVitius

Calling attemptLoad won't work because it checks if the distance from the top of the component to the bottom of the scroll container is less than the minimum (https://github.com/PeachScript/vue-infinite-loading/blob/master/src/components/InfiniteLoading.vue#L262).

The existing API doesn't expose a way to do this, but you can force the functionality like this:

this.$refs.infiniteLoading.status = 1
this.$refs.infiniteLoading.$emit('infinite', this.$refs.infiniteLoading.stateChanger)

If you think this would be a valuable feature, it looks like it would be a simple change to make a PR for.

This works but the infinite loading stops after 2 or 3 loadings. i fixed the issue by only using the following code

this.$refs.infiniteLoading.$emit("$InfiniteLoading:reset", { target: this.$refs.infiniteLoading, });

lonelypx avatar Aug 15 '22 04:08 lonelypx