How to pass parameters into the function? #16
Comments
I have been using like so, but I am really curious about it and maybe that way I do is not a good practice. <ul v-for="pessoa in pessoas">
<li>
<a href="#" v-on:click="showPessoa(pessoa)">{{ pessoa.nome }}</a>
</li>
</ul> // ...
methods : {
showPessoa : function(pess){
console.log(pess);
alert(pess.nome);
}
} |
If you not need the $event argument,you can do this: |
Hi, i have something like this:
I have a problem with get a target from this. This is my function for Vue:
Is possible to get clicked element with arguments? I tried add this to html v-on:click like a third argument and try to display it with thirdArgument.target, but i getting undefined into console. (I working with laravel, {{$people->id}} is PHP variable and i normally can display this attributes into removeRelation function). //Edit Nevermind, needed add $event like a attribute: |
Something like this worked for me just fine.
Hope it helps |
@bognix this is not clear code, check post before your, i added solution. |
cool! thanks for posting, I missed the link |
understand |
1 similar comment
understand |
v-touch="press: func()"
=>func()
will be excuted after the page is loaded, and the press event is not working.but
v-touch="press: func"
works fine.Then how to pass parameters?
The text was updated successfully, but these errors were encountered: