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 RouterLink event on click #856

Closed
marsimeau opened this issue Mar 30, 2021 · 1 comment
Closed

Add RouterLink event on click #856

marsimeau opened this issue Mar 30, 2021 · 1 comment

Comments

@marsimeau
Copy link

Linked to vuejs/vue-router#800.

What problem does this feature solve?

In vue 2 we could add v-on:click.native="myClickHandler" on RouterLink to listen for clicks on the link element. This is no longer possible since the .native modifier has been removed. Since using the @click event currently breaks the link, adding a click event or an equivalent would allow us to replicate that simple pattern without having to wrap the link which is unconventional or having to customize it with the custom prop which is much more verbose.

What does the proposed API look like?

Emit a click event:

<router-link to="/my-route" @click="myClickHandler">My link</router-link>

Or emit a navigate event, if click isn't considered the right event for this.

<router-link to="/my-route" @navigate="myNavigateHandler">My link</router-link>
@posva
Copy link
Member

posva commented Mar 30, 2021

Duplicate of #846

@posva posva closed this as completed Mar 30, 2021
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

2 participants