Skip to content

Add onComplete & onAbort to router-link #3027

Open
@XAMPPRocky

Description

@XAMPPRocky

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionneeds RFCThis feature request needs to go through the RFC process to gather more information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions