-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Call scrollBehavior with app context #1804
Conversation
This allows us to listen for events in the scroll behavior hook, thus enabling us to resolve a promise returned by the hook upon triggering of some custom event (for example one emited on the $root by an after-leave transition event).
Hey @yyx990803 any chance of squeezing this one in with the next patch release? 😃 |
Maybe passing the instance in as the 4th argument is better. |
I was wondering if app was the right context, I kind of followed nuxt conventions as that is how I've entered Vue land. Should I update the PR then? If you don't mind me asking - what makes you think 4th arg is better? Thanks! |
No other functions in vue-router have the context set to the root, and it's a function declared on the router options so it wouldn't be intuitive to have the context set to the app. I also think an extra argument makes more sense |
And should the extra argument be `app`? Bit of a Vue noob here so just
making sure this is best.
…On 15 Oct 2017 13:07, "Eduardo San Martin Morote" ***@***.***> wrote:
No other functions in vue-router have the context set to the root, and
it's a function declared on the router options so it wouldn't be intuitive
to have the context set to the app. I also think an extra argument makes
more sense
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1804 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABAcGWyiKWHZaR0_THH0CcUQf6DYqDM0ks5ssfWSgaJpZM4P3bJ9>
.
|
@posva @yyx990803 agreed that app doesn't make sense for the context, it should be router if anything. Why is 4th argument better? I would expect the context to be set in router function/hooks etc. and it seems strange to pass router object to a function of itself. |
Happy to change this guys, just let me know. |
|
* Call scrollBehavior with app context This allows us to listen for events in the scroll behavior hook, thus enabling us to resolve a promise returned by the hook upon triggering of some custom event (for example one emited on the $root by an after-leave transition event). * Update scrollBehavior example * change scrollBehavior context to router
Thank you so much for this fix it's a life saver! The only thing that worked flawlessly with Vue transitions and vue-router to make silky smooth fades from 1 page to another. This fix has been around for quite some time without being released, wondering if there are plans for a new release of vue-router soon? It was quite confusing because there was an example in the live documentation but it didn't work in code because the latest official release is |
This allows us to listen for events in the scroll behavior hook, thus enabling us to resolve a promise returned by the hook upon triggering of some custom event (for example one emited on the $root by an after-leave transition event).
Sorry for hastily done PR.
Ref: nuxt/nuxt#1376 (comment)