Meituan-Dianping/mpvue · error
Use "contextmenu" instead of "click.right" since right click
Error message
Use "contextmenu" instead of "click.right" since right clicks do not actually fire "click" events.
What it means
Dev-only compiler warning from genHandlers: @click.right was used, but browsers do not fire a 'click' event for right mouse buttons, so the generated guard ($event.button !== 2) can never pass. The template should express the intent with the contextmenu event instead.
Source
Thrown at packages/weex-template-compiler/build.js:2096
left: genGuard("'button' in $event && $event.button !== 0"),
middle: genGuard("'button' in $event && $event.button !== 1"),
right: genGuard("'button' in $event && $event.button !== 2")
};
function genHandlers (
events,
isNative,
warn
) {
var res = isNative ? 'nativeOn:{' : 'on:{';
for (var name in events) {
var handler = events[name];
// #5330: warn click.right, since right clicks do not actually fire click events.
if (process.env.NODE_ENV !== 'production' &&
name === 'click' &&
handler && handler.modifiers && handler.modifiers.right
) {
warn(
"Use \"contextmenu\" instead of \"click.right\" since right clicks " +
"do not actually fire \"click\" events."
);
}
res += "\"" + name + "\":" + (genHandler(name, handler)) + ",";
}
return res.slice(0, -1) + '}'
}
function genHandler (
name,
handler
) {
if (!handler) {
return 'function(){}'
}
if (Array.isArray(handler)) {View on GitHub (pinned to 6c5d78ee04)
Solutions
- Replace @click.right with @contextmenu
- Remember to .prevent on contextmenu if the native menu should be suppressed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/weex-template-compiler/build.js:2096 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Meituan-Dianping/mpvue@6c5d78ee04 (2026-09-02).
Data as JSON: /api/errors/41f6354bdf5effa4.
Report an issue: GitHub.