I have the following element, which listens on the drawend
event.
<ol-interaction-draw
ref="test"
@drawend="drawend"
>
When drawend
is triggered normally by the element itself, event
is passed to the function:
drawend(event) {
console.log(event);
}
But when I try to trigger it manually, event
is undefined
.
test = ref(null);
test.$emit("drawend");
How can I emit the event correctly?
When you call an event like this:
in fact, you are calling:
Where $emit has a second parameter - the event object or any other data.
Try to do this, for example, and you will see for yourself what will be transferred to the draw end: