Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manual trigger #303

Open
kilkujadek opened this issue Dec 20, 2020 · 2 comments
Open

Manual trigger #303

kilkujadek opened this issue Dec 20, 2020 · 2 comments

Comments

@kilkujadek
Copy link

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?

@nVitius
Copy link

nVitius commented Jan 1, 2021

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.

@lonelypx
Copy link

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, });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants