L
L
lillianfisher2021-04-13 19:13:05
Vue.js
lillianfisher, 2021-04-13 19:13:05

How to make vue analog onClick="foo(this)" work?

In js, you can hang an event on an element and send a pointer to the element to a function:

<div onClick="foo(this)">

function foo(el){
alert(el);
}

But how to do it in vue? I.e ,

<div @click="foo(this)">
foo(el){
alert(el);
}

does not work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
ZB Venom, 2021-04-13
@lillianfisher

Read

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question