v-money icon indicating copy to clipboard operation
v-money copied to clipboard

How to "maxlength" in this component?

Open bgoncal opened this issue 6 years ago • 7 comments

bgoncal avatar Mar 16 '18 01:03 bgoncal

Ditto. Dealbreaker without ability to define max value. :/

paulpv avatar Apr 03 '18 19:04 paulpv

Would be nice if they would merge https://github.com/vuejs-tips/v-money/pull/36!

paulpv avatar Apr 04 '18 22:04 paulpv

I'm having this issue too, anyone know how to limit v-money component?

luccasparoni avatar Mar 25 '19 16:03 luccasparoni

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 },

betonix avatar Jul 23 '19 22:07 betonix

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

matheushf avatar Sep 30 '19 01:09 matheushf

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!

lndr-ssantos avatar Feb 18 '20 17:02 lndr-ssantos

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!

jonathanpmartins avatar Aug 28 '21 03:08 jonathanpmartins