Following #650 . Sometimes we want to use a router-link component to benefit from its visited state or other things but manually handle the @click and it's necessary to use native. Even though it's said on the vue docs, it's better to repeat ourselves a bit
ATM there's no place on the docs where we mention the @click with a router-link so I think we could add a little note at the bottom of : https://router.vuejs.org/en/api/router-link.html
Hmm after checking the src of router-link, I think maybe it can be made a functional component to support both on and nativeOn (since it doesn't need an instance, and $router reference can be accessed from ctx.parent).
This way we can directly support @click, instead of the counterintuitive @click.native (and we can add support for .native for compatibility)
<router-link @click="foo"/>
I haven't checked further but it can be useful to transform it into a functional component if possible.
But I don't think it's counterintuitive to use @click.native. Quite the opposite. It's a component so I'll always use @click.native but we can make both ways work
Closing as we are making the router-link a functional component in #2029
Most helpful comment
I haven't checked further but it can be useful to transform it into a functional component if possible.
But I don't think it's counterintuitive to use
@click.native. Quite the opposite. It's a component so I'll always use@click.nativebut we can make both ways work