0👍
To stop the click
-event from bubbling to the parent, use a custom <router-link>
that uses the stop
event modifier on the underlying link’s @click
:
-
Apply the
custom
prop on the<router-link>
. -
In the
<router-link>
‘s default slot, add an<a>
with itshref
bound to the slot’shref
prop. -
Also add a
click
-event handler that calls the slot’snavigate
prop (a function that navigates to<router-link>
‘sto
prop). Also apply the.stop
event modifier to theclick
-event listener to stop the event from propagating to the parent elements.
<router-link :to="'/project/' + blabla.project.id"
custom 1️⃣
v-slot="{ navigate, href }">
<a :href="href" 2️⃣
@click.stop="navigate" 3️⃣
>
Details
</a>
</router-link>
Source:stackexchange.com