Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

283
Vistas
Nuxt: how to prevent redirecting to another page when clicking on button on top of NuxtLink?

In this piece of code, I have a v-card, which redirects user to another page. I wanted to put a button into the v-card to do something different:

<NuxtLink :to="`books/1`" style="text-decoration: none;">
  <v-card hover width="400px">
    <v-card-text>
      <span>
        Book 1
      </span>

      <!-- button that does something different -->
      <v-btn icon @click="addToFavourites(1)">
        <v-icon>
          mdi-star-outline
        </v-icon>
      </v-btn>
    </v-card-text>
  </v-card>
</NuxtLink>
addToFavourites(id) {
  console.log("add book " + id + " to favourites");
}

Now whenever I click on the button it redirects me to another page, but addToFavourites does not redirect user to another page. How do I prevent redirecting user to another page when clicking on the button?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda