S
S
Sergey Sokolov2018-06-29 15:19:08
JavaScript
Sergey Sokolov, 2018-06-29 15:19:08

How to catch and click on the v-list-tile in Vuetify v-list and open the menu when the icon is clicked?

The component renders a list similar to Icons with 2 lines and action:
5b36230198af3018892815.png
Clicking on the small icon opens a menu. It is not possible to add click processing on the entire tile. As soon as I add a tile click handler , the menu stops working - a click on the icon works like a click on the entire tile.v-on:click.stop="goDetails(user.id)"

markup
<v-list two-line>

    <v-list-tile
      avatar
      v-for="user in users"
      v-bind:key="user.id"
      v-on:click.stop="goDetails(user.id)"
    >
    
      <v-list-tile-avatar>
        <img :src="user.avatar">
      </v-list-tile-avatar>

      <v-list-tile-content>
        <v-list-tile-title>{{ user.name }}</v-list-tile-title>
        <v-list-tile-sub-title v-html="user.group"></v-list-tile-sub-title>
      </v-list-tile-content>

      <v-list-tile-action>

        <v-menu offset-y>
          <v-btn slot="activator" icon ripple>
            <v-icon color="grey">more_vert</v-icon>
          </v-btn>
          <v-list>
            <v-list-tile>
              <v-list-tile-title v-on:click.stop="settings(user.id)">Настройки</v-list-tile-title>
            </v-list-tile>
            <v-list-tile>
              <v-list-tile-title v-on:click.stop="deleteAccount(user.id)">Удалить</v-list-tile-title>
            </v-list-tile>
          </v-list>
        </v-menu>

      </v-list-tile-action>
    </v-list-tile>

</v-list>

Upd. Added Fiddle . Icon click should not triggergoDetails()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Proskurin, 2018-06-29
@sergiks

remove v-on:click.stop - stop
UPD: add @click.stop to v-list-tile-action and leave v-list-tile just v-on:click="goDetails(user.id)"
https: //jsfiddle.net/z9mf503r/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question