The Wayback Machine - https://web.archive.org/web/20220718112358/https://github.com/vuejs/vue/issues/12319
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.exact modifier : Failed to generate render function #12319

Open
rcocco opened this issue Oct 11, 2021 · 1 comment · May be fixed by #12321
Open

.exact modifier : Failed to generate render function #12319

rcocco opened this issue Oct 11, 2021 · 1 comment · May be fixed by #12321

Comments

@rcocco
Copy link

@rcocco rcocco commented Oct 11, 2021

Version

2.6.14

Reproduction link

https://template-explorer.vuejs.org/#%3Cbutton%20%40keydown.ctrl.shift.alt.meta.exact%3D%22console.log(%24event)%22%3EClick%3C%2Fbutton%3E

Steps to reproduce

use v-on with .ctrl.shift.alt.meta.exact modifiers

What is expected?

added event listener successfully

What is actually happening?

[Vue warn]: Failed to generate render function:
SyntaxError: Unexpected token ')' in


compiler generates if()return null; that's a syntax error.

 else if (key === 'exact') {
          var modifiers = (handler.modifiers);
          genModifierCode += genGuard(
            ['ctrl', 'shift', 'alt', 'meta']
              .filter(function (keyModifier) { return !modifiers[keyModifier]; })
              .map(function (keyModifier) { return ("$event." + keyModifier + "Key"); })
              .join('||')
          );
        }
@posva
Copy link
Member

@posva posva commented Oct 11, 2021

This should be an easy fix in the compiler: avoiding adding that last if when the condition is empty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants