A
A
Alexey Babiev2022-02-17 09:39:45
Vue.js
Alexey Babiev, 2022-02-17 09:39:45

How to get $event in vue if event has more than one parameter?

The third party component emits an event with two parameters:

@dragstop="dragged"

dragged(x, y) {
  console.log(x, y);
}

// 120, 50


I want to pass one more parameter:
@dragstop="dragged(id, $event)"

dragged(id, x, y) {
  console.log(id, x, y);
}

// myid 120 undefined


Naturally, only x gets into $ event

Tell me how to accept both native parameters, including your own?

UPD: vue2

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vadim, 2022-02-17
@axsmak

@dragstop="(x, y) => dragged(id, x, y)"

dragged(id, x, y) {
  console.log(id, x, y);
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question