Reputation: 13450
<parent v-on:click="isActive = !isActive">
<router-link :to="{ name: 'home'}">{{tag}}</router-link>
</parent>
If the router-link
is clicked the v-on:click
in the parent will still capture the event.
How to make the router-link
consume the click event completely?
Upvotes: 4
Views: 1484
Reputation: 13450
Ok found a workaround. Since router-link
renders an a
then the v-on:click.stop
is not propagated to that rendered a
. But if you wrap it with a div
which contains the stop, it will work.
<parent v-on:click="isActive = !isActive">
<div v-on:click.stop>
<router-link :to="{ name: 'home'}">{{tag}}</router-link>
</div>
</parent>
Upvotes: 6