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.

Feature request: allow to acess to the modifier for v-on when bound to functional component

See original GitHub issue

It would be nice to share v-on modifier for functional components to add ability to extend standard v-on modifiers.

In simple cases we can work around of this by adding additional props to the functional component e.g. <my-comp @reset="process" modifier="hard"></my-comp>.

But there are cases when it is very difficult to do it the same way. I believe, this feature will help with this.

As an example with this feature we can create something like input-context component which handles input event when it is in focus:

<input-context 
    :focus="isFocused" 
    @click="isFocused = true" 
    @key.down="scrollDown(1)" 
    @wheel.down="scrollDown(3)">
      ...
</input-context>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
yyx990803commented, Jan 11, 2017

Most modifiers (except .once and .native) are actually specific to native events, so they don’t really make much sense on components anyway. I think it’s best to keep component events simple and just use event name to differentiate them, since they are ultimately different events rather than the same event with different behavior.

0reactions
OEvgenycommented, Nov 20, 2016

@yyx990803 hmm, you are right, probably nothing. Only it looks different from @keyup.down default syntax, but definitely can be used.

When we define v-on handler on component with modifier, it will silently be ignored and event without modifier will be fired. May be we can pass raw string with modifier (e.g. key.down) to the component event when it is not native event, or warn in dev mode what dot notation is not supported for component events. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

State Management within React Functional Components with ...
Your components can bind to the value of isAuthenticated. The only way to mutate the state and its binding is to call the...
Read more >
Vue 3 JSX Design · Issue #141 · vuejs/jsx-vue2 - GitHub
We are using this thread to unify the design and land on an official specification of how Vue features should be handled in...
Read more >
Manifest.permission - Android Developers
Allows an application to collect component usage statistics. Declaring the permission implies intention to use the API and the user of the device...
Read more >
Build a web application with React and Kotlin/JS — tutorial
Build a web application with React and Kotlin/JS — tutorial. This tutorial will teach you how to build a browser application with Kotlin/JS ......
Read more >
core - Apache HTTP Server Version 2.4
On: A request will be accepted if a leading path component maps to a file that ... Allow use of the directives controlling...
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