Skip to content

@click on router-link does not work #650

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
Centaur opened this issue Sep 10, 2016 · 7 comments
Closed

@click on router-link does not work #650

Centaur opened this issue Sep 10, 2016 · 7 comments

Comments

@Centaur
Copy link

Centaur commented Sep 10, 2016

Vue.js & vue-router.js version

2.0.0-rc.5 & 2.0.0-rc.4

Reproduction Link

https://jsfiddle.net/oldpig/qos7px6j/1/

Steps to reproduce

click /parent link

What is Expected?

parentClicked handler should be invoked and "parentClicked" message should be logged in console

What is actually happening?

no log

This looks similar to #390

@posva
Copy link
Member

posva commented Sep 10, 2016

You need to add the .native modifier.
Next time provide a more concise repro please. It's easier for us to help 😉
https://jsfiddle.net/posva/gh7mzwe7/

@posva posva closed this as completed Sep 10, 2016
@plauclair
Copy link

@posva thanks for the tip. I really feel this should be in the router-link documentation though. Cheers. 🙂

@LinusBorg
Copy link
Member

<router-link> is just a Vue component. to listen for native events on components, you need that modifier - and that is explained in the Vue docs.

@plauclair
Copy link

It is, but it's still easy to miss and although I do spend a lot of time in the docs, this didn't occur to me at first. Beginners won't think about using modifiers, if they even know about the feature at all.

Adding to docs is a quick thing that will make a lot of us save a lot of time. 👍

@amirrustam
Copy link

@LinusBorg I come from the Django (Python) world, which is well known for having some of the best and most extensive documentation for an OSS project. One of the things the Django documentation does is include relevant notes and disclaimers regarding common mistakes, misunderstandings, or things that are easily overlooked. So overtime, the documentation attains a "collective wisdom."

I've been working with Vue for a little while now, and I think the documentation is great, and has always been improving, but I agree with @plauclair for these types of cases, where a small note in the documentation can save a lot of human time. Just my two cents!

@LinusBorg
Copy link
Member

Thanks for The input, I think we really can improve that situation.

@yanm1ng
Copy link

yanm1ng commented May 26, 2017

you can use watcher to listen router change event

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

6 participants