From f1abb85b4843a64a312207b683c4483b5d2ff395 Mon Sep 17 00:00:00 2001 From: DCloud_LXH <283700113@qq.com> Date: Tue, 21 Dec 2021 18:31:33 +0800 Subject: [PATCH] fix(H5): processEvent add contextmenu --- src/core/view/plugins/events.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/view/plugins/events.js b/src/core/view/plugins/events.js index 16656149c..12314e01a 100644 --- a/src/core/view/plugins/events.js +++ b/src/core/view/plugins/events.js @@ -49,6 +49,10 @@ function processTouches (touches) { return [] } +function isPCEvent (name) { + return name.startsWith('mouse') || ['contextmenu'].includes(name) +} + export function processEvent (name, $event = {}, detail = {}, target = {}, currentTarget = {}) { if ($event._processed) { $event.type = detail.type || name @@ -90,7 +94,7 @@ export function processEvent (name, $event = {}, detail = {}, target = {}, curre stopPropagation () {} }) - if (name.startsWith('mouse')) { + if (isPCEvent(name)) { const { top } = getWindowOffset() -- GitLab