0.1.8 • Published 4 years ago

vuelidate-caption v0.1.8

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
4 years ago

vuelidate-caption

Description

A component that displays validation errors, built for Vuelidate

Project setup

npm install vuelidate-caption

Import the component

import VuelidateCaption from 'vuelidate-caption'

export default {
    components: {
        VuelidateCaption
    }
}

Usage

<template>
    <div>
        <input type="text" v-model="$v.example.$model">
        <VuelidateCaption :model="$v.example" :validationMessages="validationMessages">
    </div>
</template>

import VuelidateCaption from 'vuelidate-caption'
import { required } from 'vuelidate/lib/validators'

export default {
    components: {
        VuelidateCaption
    },

    validations: {
        example: { required }
    },

    computed: {
        validationMessages: () => {
            required: 'Required value'
        }
    }

    data: () => {
        example: ''
    }
}

Whenever $error is triggered on the Vuelidate Model (model prop), the corresponding validation message from validationMessages will be rendered.

Props

PropDescriptionDefault
modelThe corresponding Vuelidate Model, which contains $error, $invalid, $dirty propertiesEmpty object (() => {})
validationMessagesAn object that contains the validation messages (eg. { validation-name: 'Validation message'})Empty object (() => {})
ClassString to be applied to the rendered component's class attributeEmpty String ('')
0.1.8

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago