fix(runtime-core): fix multiple .once event handlers on same component (#3904)

fix #3902
This commit is contained in:
LYlanfeng
2021-06-08 21:52:45 +08:00
committed by GitHub
parent 2b52d5d7c5
commit 011dee8644
2 changed files with 10 additions and 3 deletions

View File

@@ -149,10 +149,11 @@ export function emit(
const onceHandler = props[handlerName + `Once`]
if (onceHandler) {
if (!instance.emitted) {
;(instance.emitted = {} as Record<string, boolean>)[handlerName] = true
instance.emitted = {} as Record<any, boolean>
} else if (instance.emitted[handlerName]) {
return
}
instance.emitted[handlerName] = true
callWithAsyncErrorHandling(
onceHandler,
instance,