v-money
v-money copied to clipboard
How to "maxlength" in this component?
Ditto. Dealbreaker without ability to define max value. :/
Would be nice if they would merge https://github.com/vuejs-tips/v-money/pull/36!
I'm having this issue too, anyone know how to limit v-money component?
you can put "maxlength" on object money, and works. but you have to put one more, because of the comma.
money: { decimal: ',', thousands: '.', suffix: '', precision: 2, maxlength: 6, masked: false },
Workaround is to wrapp it in another component and use this:
methods: {
calcMaxLength(value) {
if (parseFloat(value) === 0) {
this.setMaxLength(2);
} else {
this.setMaxLength(1);
}
},
setMaxLength(extraChar) {
this.maxLength = this.integerPlaces + this.decimalPlaces + extraChar;
},
},
Call calcMaxLength
on your input event
you can put "maxlength" on object money, and works. but you have to put one more, because of the comma.
Thank you, @betonix ! Help me a lot!
hey, Unfortunately I don't think support will come soon. This repo seems to be abandoned! I decided to upgrade this package to be used with Vue3.
Welcome v-money3
!
v-money3
has the max
attribute that takes care of maximum user inputs. Feel free to test it out!