Proposal: Add native v-model modifiers like .capitalize, .upper, .mask etc. #775
Closed
RikkuKaiser
started this conversation in
General
Replies: 1 comment
-
|
Duplicate of #376 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Context
Vue's
v-modelcurrently supports a few useful built-in modifiers like:.trim.number.lazyThese are extremely helpful to reduce boilerplate in components and forms.
However, in real-world scenarios, developers often need to apply other common input transformations, which currently require custom components or computed setters.
Suggested new native modifiers
.capitalize<input v-model.capitalize="name" />.upper<input v-model.upper="city" />.lower<input v-model.lower="email" />.alphanumeric<input v-model.alphanumeric="user" />.mask<input v-model.mask="phone" mask="(###) ###-####" />Benefits
.trimand.numbernativelyProposal Details
.maskmight require av-model.mask="..."+ amaskprop/attributeWilling to contribute
Yes, I’d be happy to collaborate or submit a PR, starting with
v-model.capitalizeif the core team supports the direction.If there is already something similar in development or discussion, I’d really appreciate being pointed to it so I can contribute or align my efforts.
Thanks for considering!
Beta Was this translation helpful? Give feedback.
All reactions