提交 06d67c91 编写于 作者: D DCloud_LXH

fix(mp): 添加 data-eventsync 属性标识该事件同步执行 question/142353

上级 2d2fdccc
......@@ -5366,7 +5366,13 @@ function createInvoker(initialValue, instance) {
const eventValue = invoker.value;
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)) {
const eventTarget = e.target;
const eventSync = eventTarget
? eventTarget.dataset
? eventTarget.dataset.eventsync === 'true'
: false
: false;
if (bubbles.includes(e.type) && !eventSync) {
setTimeout(invoke);
}
else {
......
......@@ -85,7 +85,13 @@ function createInvoker(
)
// 冒泡事件触发时,启用延迟策略,避免同一批次的事件执行时机不正确,对性能可能有略微影响 https://github.com/dcloudio/uni-app/issues/3228
if (bubbles.includes(e.type)) {
const eventTarget = (e as MPEvent).target
const eventSync = eventTarget
? eventTarget.dataset
? eventTarget.dataset.eventsync === 'true'
: false
: false
if (bubbles.includes(e.type) && !eventSync) {
setTimeout(invoke)
} else {
return invoke()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册