|
|
@@ -34,10 +34,25 @@ const modifierCode: { [key: string]: string } = {
|
|
|
right: genGuard(`'button' in $event && $event.button !== 2`)
|
|
|
}
|
|
|
|
|
|
-export function genHandlers (events: ASTElementHandlers, native?: boolean): string {
|
|
|
+export function genHandlers (
|
|
|
+ events: ASTElementHandlers,
|
|
|
+ native: boolean,
|
|
|
+ warn: Function
|
|
|
+): string {
|
|
|
let res = native ? 'nativeOn:{' : 'on:{'
|
|
|
for (const name in events) {
|
|
|
- res += `"${name}":${genHandler(name, events[name])},`
|
|
|
+ const 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) + '}'
|
|
|
}
|