|
@@ -105,17 +105,25 @@ export function emit(
|
|
|
handlerName = toHandlerKey(hyphenate(event))
|
|
handlerName = toHandlerKey(hyphenate(event))
|
|
|
handler = props[handlerName]
|
|
handler = props[handlerName]
|
|
|
}
|
|
}
|
|
|
- if (!handler) {
|
|
|
|
|
- handler = props[handlerName + `Once`]
|
|
|
|
|
|
|
+
|
|
|
|
|
+ if (handler) {
|
|
|
|
|
+ callWithAsyncErrorHandling(
|
|
|
|
|
+ handler,
|
|
|
|
|
+ instance,
|
|
|
|
|
+ ErrorCodes.COMPONENT_EVENT_HANDLER,
|
|
|
|
|
+ args
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const onceHandler = props[handlerName + `Once`]
|
|
|
|
|
+ if (onceHandler) {
|
|
|
if (!instance.emitted) {
|
|
if (!instance.emitted) {
|
|
|
;(instance.emitted = {} as Record<string, boolean>)[handlerName] = true
|
|
;(instance.emitted = {} as Record<string, boolean>)[handlerName] = true
|
|
|
} else if (instance.emitted[handlerName]) {
|
|
} else if (instance.emitted[handlerName]) {
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- if (handler) {
|
|
|
|
|
callWithAsyncErrorHandling(
|
|
callWithAsyncErrorHandling(
|
|
|
- handler,
|
|
|
|
|
|
|
+ onceHandler,
|
|
|
instance,
|
|
instance,
|
|
|
ErrorCodes.COMPONENT_EVENT_HANDLER,
|
|
ErrorCodes.COMPONENT_EVENT_HANDLER,
|
|
|
args
|
|
args
|