提交 dfbc9654 编写于 作者: fxy060608's avatar fxy060608

fix(mp-weixin): input event support return value (#3371)

上级 36fb9ebd
......@@ -5364,15 +5364,13 @@ function createInvoker(initialValue, instance) {
args = e.detail.__args__;
}
const eventValue = invoker.value;
const invoke = () => {
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, eventValue), instance, 5 /* NATIVE_EVENT_HANDLER */, args);
};
const invoke = () => callWithAsyncErrorHandling(patchStopImmediatePropagation(e, eventValue), instance, 5 /* NATIVE_EVENT_HANDLER */, args);
// 冒泡事件触发时,启用延迟策略,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
if (bubbles.includes(e.type)) {
setTimeout(invoke);
}
else {
invoke();
return invoke();
}
};
invoker.value = initialValue;
......
......@@ -16,7 +16,7 @@ import {
type EventValue = Function | Function[]
interface Invoker {
(evt: MPEvent): void
(evt: MPEvent): unknown
value: EventValue
}
......@@ -76,19 +76,19 @@ function createInvoker(
args = (e as MPEvent).detail.__args__!
}
const eventValue = invoker.value
const invoke = () => {
const invoke = () =>
callWithAsyncErrorHandling(
patchStopImmediatePropagation(e, eventValue),
instance,
ErrorCodes.NATIVE_EVENT_HANDLER,
args
)
}
// 冒泡事件触发时,启用延迟策略,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
if (bubbles.includes(e.type)) {
setTimeout(invoke)
} else {
invoke()
return invoke()
}
}
invoker.value = initialValue
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册