S
S
Sergey Sokolov2019-03-04 23:34:53
JavaScript
Sergey Sokolov, 2019-03-04 23:34:53

How to stop a click event from a sub-component that breaks through despite .stop?

Vuetify v-list-tile elements contain action buttons.
When I made the element a Vue-Router link via the property to, button clicks also jumped to the router link. Despite the stop modifier:@click.stop="..."

Sample template
<template>
  <v-list-tile :to="'/details/' + id">
  
    <v-list-tile-content>
      <v-list-tile-title>{{ title }}</v-list-tile-title>
    </v-list-tile-content>
    
    
    <v-list-tile-action>
      <v-btn icon @click.stop="saveas">
        <v-icon color="grey lighten-1">save_alt</v-icon>
      </v-btn>
    </v-list-tile-action>
    <v-list-tile-action>
      <v-btn icon @click.stop="refresh">
        <v-icon color="grey lighten-1">refresh</v-icon>
      </v-btn>
    </v-list-tile-action>

  </v-list-tile>
</template>

How to prevent router-link from firing when clicking on v-btn inside?
upd . It seems that the point is that when the attribute is present to, the component is rendered inside the anchor tag , which causes clicks on any elements inside it to fire as a link. What can be done about it? <a>

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Robur, 2019-03-05
@sergiks

Will help.prevent

A
Alexander Pushkarev, 2019-03-05
@AXP-dev

Well, there are 2 options:
1) v-list-tileChange from toto @clickand track there already
2) We v-list-tilehave a prop tag, send a div there, by default it takes from router-link, and therea

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question