NuxtN
Nuxt2y ago
2 replies
Aleksandar Brkić

Event name from variable

I was wondering if there was a way of emitting an event whose name comes from a variable. For instance:
const emit = defineEmits<{
  close: void[]
  open: void[]
}>()
const eventName = ref<'close' | 'open'>('close')
emit(eventName.value) // ts error No overload matches this call.
Was this page helpful?