prozac2112
16.04.2019, 13:44:19
Mam problem, w jaki sposób mogę w Vue dostać się do atrybutów a, nawet jeśli kliknę na i.
<a href="#" v-on:click.stop.prevent="showa">
tekst <i>zdjęcie</i>
</a>
public showa(event): void{
console.log(event.target);
}
gitbejbe
18.04.2019, 15:45:22
public showa(event): void{
var target = event.target;
var href = null;
if(event.target.tagname == 'a'){
href = target.getAttribute('href');
}
else {
href = target.closest('a').getAttribute('href');
}
console.log(href);
}