List – Vuetifyを見ながらリストを実装していたのだが、
v-list-tileのイベントと、その子であるv-list-tile-actionのイベントを実装すると、v-list-tile-actionをタップしたときに2つのイベントが同時に発火してしまった困ったのでその対策メモ
答えはここに書いてあるんだけど
Versions and Environment Vuetify: 1.1.9 Vue: 2.5.17 Browsers: Chrome OS: Windows 10 Steps to reproduce create a v-list-tile with @click create a v-list-tile-action with v-btn @click click on v-btn ... v-list click colides with avatar click · Issue #4793 · vuetifyjs/vuetify - GitHub |
@click.stop=”…
https://developer.mozilla.org/en-US/docs/Web/API/Event/stopPropagation
いや、それだけじゃ使い方全然わからんていう。
で、どうやるかというと、@click.stop=”呼びたいメソッド”を親と子、それぞれで定義してあげればいいみたいだった。
上の例題で言うならこんなかんじ
<v-list-tile v-for="item in items" :key="item.title" avatar @click.stop="onListTileItemClick()" <<<<<<<<<<<<<<<<<<<<< > <v-list-tile-avatar> <v-icon :class="[item.iconClass]">{{ item.icon }}</v-icon> </v-list-tile-avatar> <v-list-tile-content> <v-list-tile-title>{{ item.title }}</v-list-tile-title> <v-list-tile-sub-title>{{ item.subtitle }}</v-list-tile-sub-title> </v-list-tile-content> <v-list-tile-action> <v-btn icon ripple @click.stop="onButtonInfoItemClick()"> <<<<<<<<<<<<<<< <v-icon color="grey lighten-1">info</v-icon> </v-btn> </v-list-tile-action> </v-list-tile>
なんとかなってめでたしめでたし。
こんにちは。virapture…
View Comments
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://accounts.binance.com/ph/register-person?ref=YY80CKRN
Your article helped me a lot, is there any more related content? Thanks! https://accounts.binance.com/ur/register?ref=V3MG69RO
I don't think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
This was beautiful Admin. Thank you for your reflections.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.