How in v-money component validate with vee-validate

982 Views Asked by At

I use v-money component (https://github.com/vuejs-tips/v-money) 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",

0

There are 0 best solutions below