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

Add onComplete & onAbort to router-link #3027

XAMPPRocky opened this issue Nov 10, 2019 · 0 comments

Add onComplete & onAbort to router-link #3027

XAMPPRocky opened this issue Nov 10, 2019 · 0 comments


Copy link

@XAMPPRocky XAMPPRocky commented Nov 10, 2019

What problem does this feature solve?

In 2.2.0 Vue added onComplete and onAbort callbacks to router.push, however there seems to be no equivalvent when using <router-link>. I've seen suggestions that can you use beforeRouteEnter as an alteranative in some cases, however I have a case where I have a <header> containing <router-link>s that remains on the page after a user clicks on the router link, I want to be able to change a property of the header after the user has clicked the link. So beforeRouteEnter would not work for my case. Ideally I'd like to be able to supply onComplete and onAbort to the router-link directly.

What does the proposed API look like?

Personally I have no preference over how this should look, I'm not experienced enough with vue router to say what is the most idiomatic, however I would expect to be something like the following.

<router-link to="" on-complete="callback" on-abort="callback"></router-link>
<!-- or -->
<router-link to="" complete="callback" abort="callback"></router-link>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
1 participant
You can’t perform that action at this time.