Summer Sale! All accounts are 50% off this week.

murilo's avatar
Level 10

How to make a vue input price format ?

Hello Guys , Does some one knows how to make something like that in VUE-

http://flaviosilveira.com/Jquery-Price-Format/

I wold like to make some price format inside the input , like if I type -

2000 . it will convert to 20,00 .

Can I use a filter inside the input ?

Thanks

0 likes
7 replies
jekinney's avatar

I suggest;

v-model.trim="input" @keyup="formatMoney" in your input element(maybe denounce="500" too)

Your formatMoney method:

Return the.input = parseFloat(this.input).toFixed(2)

murilo's avatar
Level 10

what do you mean with maybe denounce="500" ?

Thanks

murilo's avatar
Level 10

this example is just with vue 2.20 + I will need something in vue 2.0

Please or to participate in this conversation.