Proposed shorthand for v-model #395
Replies: 9 comments 13 replies
-
Nice idea, but I would assume that |
Beta Was this translation helpful? Give feedback.
-
I like the idea too, but I rather prefer a single character instead |
Beta Was this translation helpful? Give feedback.
-
Any news on this? |
Beta Was this translation helpful? Give feedback.
-
I implemented this feature - |
Beta Was this translation helpful? Give feedback.
-
Do we have any news for native implementation? |
Beta Was this translation helpful? Give feedback.
-
Is this deprecated? It's not working for me with either syntax ( Edit: Ooooh, it's because I'm using Full SFC with JSX. That must be it. Edit 2 Works beautifully so far in .vue files in Nuxt 3! |
Beta Was this translation helpful? Give feedback.
-
@warrensearle How about using |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
i would avoid any already used caracter to avoid confusion of responsability with other features
on the other hand
i am not sure if a v-model shorthand is actually helpful here, not even taking into account nested v-models case
|
Beta Was this translation helpful? Give feedback.
-
Summary
A shorthand for
v-model
with and without argumentsBasic example
::
is shorthand forv-model
::attribute
is shorthand forv-model:attribute
Motivation
Vue provides special shorthands for two of the most often used directives,
v-bind
andv-on
. Template shorthandsv-model
is also an often used directive and in Vue 3 it's usage will increase now that we have arguments and a replacement for two-way binding using.sync
. Migration guide. v-modelFrom a new and regular user point of view
:
and@
are really nice shorthands for one-way binding and events. Using::
for two-way binding seems an intuitive partner to:
.Detailed design
v-model
Shorthandv-model
with argument ShorthandUnresolved questions / considerations
::
be too easily confused with:
?Beta Was this translation helpful? Give feedback.
All reactions