question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

v-on dynamic argument doesn't work with .native modifier

See original GitHub issue

Version

2.6.0

Reproduction link

https://codesandbox.io/s/r749jp21o4

Steps to reproduce

I made a simple button component which does not emit any events. In the app there are three instances of it with the @click.native event bound in different way.

You can see the first button component which was bound with @click.native works and increases the counter, but the rest which use v-on and the new conditional binding syntax do not.

I thought it might have been some limitation of native events but this also happens with other modifiers, like keydown.somekey.

What is expected?

The events should be bound and all the buttons should work.

What is actually happening?

The buttons do not work. The events are not bound. Only the first button actually gets a listener attached when I inspect them with chrome’s devtools.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bonno123commented, Jun 14, 2022

hey @yyx990803, how can I use @[condition].native here in this codition where one condition has a modifier (v-on:keyup.enter) and another has no modifier(v-on:change)

<component 
    :is=" isCompDropdown(field) ? Dropdown : InputText"
    @keyup.enter="!isCompDropdown(field) && getUsers()"
    v-on="isCompDropdown(field) ? { change: getUsers } : {}"
/>  
0reactions
yyx990803commented, Feb 4, 2019

Directive arguments and modifiers are separate concepts. Argument is the part after v-xxx: and before any modifiers. Modifiers always start with a .. The dynamic arguments feature in 2.6 applies only to the argument, not modifiers.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue.js dynamic directive argument not working - Stack Overflow
The workaround is to either use expressions without spaces or quotes, or replace the complex expression with a computed property. Also camelCase ...
Read more >
Event Handling - Vue.js
Order matters when using modifiers because the relevant code is generated in the same order. Therefore using v-on:click.
Read more >
TSConfig Reference - Docs on every TSConfig option
If a glob pattern doesn't include a file extension, then only files with supported extensions are included (e.g. .ts , .tsx , and...
Read more >
Announcing TypeScript 4.7 Beta - Microsoft Developer Blogs
One issue with the introduction of modules to JavaScript was the ambiguity between existing "script" code and the new module code.
Read more >
Dynamic Argument Structure - ACL Anthology
This paper presents a new classification of verbs of change and modification, proposing a dynamic interpretation of the lexical semantics of the predicate ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found