我正在尝试获取在以下代码中附加了事件侦听器的元素。
<div class="navigation-link" id="home" @click="click($event)">
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>Home
</button>
</div>
<div class="navigation-link" id="cms" @click="click($event)">
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>CMS
</button>
</div>
<div class="navigation-link" id="contact" @click="click($event)">
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>Contact
</button>
</div>
但是当我点击链接时,我会根据确切的点击位置获取这些元素:
<i class="material-icons left">contact_mail</i>Home
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>Home
</button>
<div class="navigation-link" id="home">
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>Home
</button>
</div>
我只想得到这个元素
<div class="navigation-link" id="home">
<button class="navigation-link-inner btn-large transparent z-depth-0">
<i class="material-icons left">contact_mail</i>Home
</button>
</div>
即我附加了事件侦听器的父元素。我怎样才能得到这个?是否有一种简短的方法可以通过仅将一个事件侦听器附加到父级而不是每个链接来做到这一点?
翻翻过去那场雪
相关分类