Pankaj
Pankaj

Reputation: 10105

Trying to assign min value in vee-validate dynamically

Vue.js component is like below.

<template>    
    <div class="container">
        <input type="text" name="first_name" v-validate data-vv-rules="min:12">
    </div>
</template>

<script>
    export default {
        props: ['messages']        
    }
</script>

In the above component, messages property is an object with one property with value like this:

this.messages.Min_Length_First_Name: 3

I am trying to assign it like below.

<input type="text" 
       name="first_name" 
       v-validate 
       data-vv-rules="min:this.messages.Min_Length_First_Name">

But, the input tag renders the min value = this.messages.Min_Length_First_Name instead of numeric value

Am I missing anything?

Upvotes: 1

Views: 1886

Answers (1)

ittus
ittus

Reputation: 22403

You should not use this in the template. It's automatically inferred

  :data-vv-rules="`required|alpha|min:${messages.Min_Length_First_Name}|max:15`

Upvotes: 2

Related Questions