1👍
This is XY problem. Generally everything that’s returned from event listeners is ignored, this includes the way Vue event handling works. It would be impossible to make await emit(...)
work like that because event listeners and triggers aren’t supposed to have 1:1 relationship.
If you rely on a promise for the correct order of execution, you may need something else. In this case a callback could be used directly inside a child instead of relying on event handling:
await props.handleClick('myAction')
- [Vuejs]-Can't install vue + webpack template
- [Vuejs]-How to import bootstrap or external js in Vue.js
0👍
To define the emits as awaitable you need to use another defineEmits
variant which looks like the following.
const emit = defineEmits<{(event: 'buttonClicked', buttonAction: string): Promise<void>}>()
Source:stackexchange.com