jonathanpmartins / v-money3

Vue3 currency input/directive mask
MIT License
103 stars 27 forks source link

Directive not working properly with Vuetify3 #78

Open will-uplanner opened 1 year ago

will-uplanner commented 1 year ago

Hey! I'm trying use as global directive with Vuetify, but it's not working well.

Every interaction on v-text-field component throws an error:

Captura de Tela 2023-03-09 às 17 35 58

PS: works fine with normal input element

jonathanpmartins commented 1 year ago

What version are you using? Can you present a sketch with some code? I need to replicate this error to be able to solve it.

nusagates commented 1 year ago

Hi, i got this error using vuetify 3.1.13.

sonofab1rd commented 1 year ago

FYI, I'm getting the same error on vuetify 3.3.1. I cloned this repo to build and use in project locally. That way I could try to come up with a fix. So far here's what I've figured out.

onKeyDown and setValue seemed to be called twice for each update to the input value. Th second call el.value is undefined. I think this is due to vuetify wrapping the native input element. The native input is a somewhat deep descendant of el when those methods are called the second time.

When onInput is called el.value is off by an order of ten. E.g. if the input reads $0.09 el.value is 0.009.

Also, I'm using a v-text-field element.

I'm guessing that the directive needs to be updated to handle vuetify v-text-field element.

I'll keep working with it and let you all know when I have an update.

Minotti commented 1 year ago

I'm getting same error while using Vuetify.

Version: "vuetify": "3.1.14"

sonofab1rd commented 1 year ago

If you use a native input element, you should not get any errors. However, if you use a Vuetify element you'll get the error. You may be able to still use this with a Vuetify element if the error doesn't bother you. And, if you can work around the value being off by an order of ten.

alhavizd commented 1 year ago

is there an update for this?

valbertVieira commented 10 months ago

+1

Minotti commented 10 months ago

Some help? heheheh

jonathanpmartins commented 9 months ago

I'm not certain this is currently feasible. Any contributions from Vuetify users via pull requests would be greatly welcomed.

For now, the recommended approach would be to utilize Vuetify's CSS within the v-money3 component.

https://github.com/vuetifyjs/vuetify/issues/17686