زوہیب خان
زوہیب خان

Reputation: 452

prevent router-link when clicked on the button inside it: VUEJS

I've been struggling on preventing the router link when clicked on the button inside it, e.g:

<router-link to="/a">
  <div>...</div>
  <button @click.prevent="somemethod()"></button>
</router-link>

When i click on the the child button, i don't want router-link to go on the route

Upvotes: 6

Views: 3196

Answers (1)

tuhin47
tuhin47

Reputation: 6048

You should have a button text. I don't see any button text. Add a button text. Then press submit.

<button @click.prevent="somemethod()">SUBMIT</button>

Upvotes: 6

Related Questions