Replies: 3 comments 3 replies
-
IMO, I feel that this approach adds to the user's burden of use and is not friendly enough. |
Beta Was this translation helpful? Give feedback.
-
alternatively we can add
|
Beta Was this translation helpful? Give feedback.
-
@lidlanca The two main issues referenced here feel kind of separate to me. What do you think about having two separate discussions? I think the CustomEvent (case-sensitive) issue is more common than the other issue, so may be more critical. On the CustomEvent issue, I'd start from what we expect the raw prop to look like. Currently I think any modifier for case sensitivity should be for compile-time transformation. To summarize I'm thinking it should look like below (mostly what you have above) <my-comp @caseSensitive.custom="handler" />
<!-- becomes and is the same as -->
<my-comp @:caseSensitive="handler" />
<!-- compiles roughly to _createElementVNode("my-comp", { "on:caseSensitive": handler }, null, 32 /* HYDRATE_EVENTS */) --> My preference on special character is Also kind of wondering if all events on custom elements should automatically get this treatment; not sure if it would cause problems or not. That's most likely where this is needed and the compiler already knows which elements are custom, so most people wouldn't even need to be aware of the custom caveat and could just write |
Beta Was this translation helpful? Give feedback.
-
emit / native event / case sensitive configurable event binding.
Summary
add modifiers syntax to event binding
a different syntax could have solved for some ambiguity, but for simplicity we can utilize dot modifiers.
with dynamic event name for some edge cases( see how we can support dot in event name itself) .
emit only (handles vue emitted events )
-- will solve Custom events should not be permeable core#6086
native event only ( handles native events )
-- will solve lack of .native
case sensitive
will solve Vue 3's v-on syntax does not support listening to custom events with capital letters core#5401
for case sensitive event name and vue emitted events, we need to be mindful that
emit
also provide a way to emit case sensitive.controlling the type of event binding, will provide greater control and flexibility, on the higher order component.
where it can't explicitly subscribe to a specific type of event, and any format/case of event naming.
Drawbacks
vue currently does not allow
.
in even binding.there is currently a workaround to use
.
in the actual event name, using dynamic event binding.it is expected that this notation will also work with the .modifiers
Examples
event .modifiers
evolved from #451 (comment)
older syntax based
Beta Was this translation helpful? Give feedback.
All reactions