D
D
dominy2021-07-10 16:54:28
Vue.js
dominy, 2021-07-10 16:54:28

How to call vue method using onClick?

Hello, can you please tell me how can I call the foo() method from

methods: {
   foo() {
            alert("sdf");
   }
}
but using onClick (@click is not suitable as you need to cancel the default action before it is executed)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2021-07-10
@dominy

Maybe v-on:click.prevent ?

D
Developer, 2021-07-10
@samodum

foo();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question