vuejs-tips / v-money

Tiny (<2k gzipped) input/directive mask for currency
https://vuejs-tips.github.io/v-money/
776 stars 256 forks source link

How in v-money component validate with vee-validate #92

Open PetroGromovo opened 4 years ago

PetroGromovo commented 4 years ago

Hello, I use v-money component on the form when I use vee-validate for data validation and the problem is that I can not make money conponent be validated : I make as :

<ValidationProvider
      name="price"
      :rules="{ required : true, min:0.01 }"
      v-slot="{ errors }"
>
   <money
         v-model="taskRow.price"
         v-bind="moneyConfig"
         name="price"
         id="price"
         class="form-control text-right"
         placeholder="Enter price"
   >

   </money>
   <p class="validation_error">{{ clearErrorMessage(errors[0]) }}</p>
</ValidationProvider>
...

    import {Money} from 'v-money'    // https://github.com/vuejs-tips/v-money

...

        data() {
            return {
                taskRow: {
                    price: 0,
                    ...
                },
        ...

        components: {
            Money,
        },

                moneyConfig: {
                    decimal: ',',
                    thousands: '.',
                    prefix: '$',
                    suffix: '',
                    precision: 2,
                    masked: false
                },

```I set 2 conditions in ValidationProvider for money control, but none of them is triggered  for default 0 value,
which I condsider as invalid.
If there is a way ?

@vue/cli 4.0.5 "v-money": "^0.8.1", "vee-validate": "^3.1.0", "vue": "^2.6.10",


Thanks!
belovolalex commented 4 years ago

I have same issue!

fdorantesm commented 4 years ago

I have same issue!

That seems that we need to fix it and make PR.

igorgoncalves commented 3 years ago

I have same issue T.T

igorgoncalves commented 3 years ago

Work's for me with the directive:

<b-input
     v-model.lazy="innerValue"
     v-money
     v-bind="$attrs"
     :size="size"
     :max="max"
     :type="type"
     :inputmode="inputmode"
     data-vv-delay="500"
     @blur="onBlur"
   ></b-input>