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.

Add custom v-model modifiers

See original GitHub issue

We have .lazy, .number, .trim and .undef is on the way.

Apart from .lazy they all work like two-way filters.

Since 2.0 does not support 2 way filters, may be there should be a new api to add custom v-model modifiers to fulfill the same need.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:53
  • Comments:52 (10 by maintainers)

github_iconTop GitHub Comments

35reactions
restoreddevcommented, Feb 20, 2017

Any chance we can get this issue reopened? A common use case for me is the need to automatically format data in a field as it’s being typed in. Something like taking ‘101216’ and turning it into ‘10/12/16’. Being able to create a custom v-model modifier would greatly simplify my code since I could write v-model.date instead of having to build a custom input component with props and events.

26reactions
newms87commented, May 28, 2017

+1 for custom modifiers. Seems like a no brainer, unless there is a good reason not to?

Masking input and parsing the value for application use is a very common practice, and making some “syntatic sugar” like v-model.lazy.currency=“amount” would be amazing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Vue Tip: Create Custom v-model Modifier - Michael Hoffmann
v -model has some built-in modifiers, but in some cases, you might need to add your custom modifier.
Read more >
How create a v-model modifier to a VueJS Component?
First, adding adding a custom modified to v-model is under discussion but not yet implemented. If it was implemented, you could extend the ......
Read more >
Form Input Bindings - Vue.js
v -model will ignore the initial value , checked or selected attributes found on any form elements. It will always treat the current...
Read more >
What you should know about Vue v-model - LearnVue
When we use a custom model name, the name of the emitted method will be update:name and the prop passed will be name...
Read more >
Vue 3 v-model modifiers - by nick_somebody - The VuesPaper
This time we'll be covering the ability to add your own modifiers to a component's v-model . Modifiers were a feature in Vue...
Read more >

github_iconTop Related Medium Post

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