Skip to content

Pass arguments for the on-infinite function #75

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

Closed
vlahde opened this issue Sep 2, 2017 · 6 comments
Closed

Pass arguments for the on-infinite function #75

vlahde opened this issue Sep 2, 2017 · 6 comments

Comments

@vlahde
Copy link

vlahde commented Sep 2, 2017

Hello, I have a page that includes a few smaller lists of movies. I ran into a problem when trying to implement on-infinite callback function:

This throws "TypeError: Cannot read property 'call' of undefined":
<infinite-loading :on-infinite="getMicroList('releases')" ref="releases" spinner="circles">

while this is ok:
<infinite-loading :on-infinite="getMicroList" ref="releases" spinner="circles">

Are multiple lists even possible on the same page without having to copy all the callback function code over and over again?

@PeachScript
Copy link
Owner

PeachScript commented Sep 4, 2017

You can use the bind method:

<infinite-loading :on-infinite="getMicroList.bind(null, 'releases')" ref="releases" spinner="circles">

Exactly, it is not the best practice, I will change the type of on-infinite to event in the next version, we will can use it like the official event listener @click:

<infinite-loading @infinite="getMicroList('releases')" ref="releases" spinner="circles">

@PeachScript PeachScript changed the title Multiple infinite loading lists on a single page? Pass arguments for the on-infinite function Sep 4, 2017
@vlahde
Copy link
Author

vlahde commented Sep 4, 2017

Thank you so much for the help and for the great component!

@PeachScript
Copy link
Owner

@vlahde you're welcome :P

@PeachScript
Copy link
Owner

Hi @vlahde , v2.2.0 has been released, include the infinite event change, you may need update the way to bind infinite function, document is here, please feedback to here if you find any problem, thanks :D

@vlahde
Copy link
Author

vlahde commented Sep 17, 2017

Works like a charm! I also love the new state system. Thanks again for the great component, man!

@PeachScript
Copy link
Owner

Thanks for your appreciation!

Best regards.

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

No branches or pull requests

2 participants