Reputation: 85
I have a timer, and a function by which the timer stops. I want to use emit in a function, it doesn't work.
const stopTimer = () => {
clearInterval(timer.value);
const emit = defineEmits(["end"]);
emit("end", reactionTime.value);
};
Upvotes: 1
Views: 1921
Reputation: 7299
defineEmits
should be called top-level in <script setup>
and not inside any arrow function.
Upvotes: 3