0.6.8 • Published 6 years ago

vue-smart-validator v0.6.8

Weekly downloads
11
License
MIT
Repository
github
Last release
6 years ago

Vue form validator

A Vue.js directive for form validation

Installation

npm instal vue-smart-validator --save

Getting Started

In your scirpt entry point:

import Vue from 'vue';
import Validator from 'vue-smart-validator';

Vue.use(new Validator());

Basic Usage

Custom error tip

<input v-model="a" v-validator="[{rule: 'required', message: 'can not be null'}, {rule: 'number', message: 'must be number'}]">
<span>{{$validator.firstError('a')}}</span>

Automatic error tip

set appendErrorTip = true

<input v-model="a" validator-appendErrorTip="true" v-validator="[{rule: 'required', message: 'can not be null'}, {rule: 'number', message: 'must be number'}]">
<!-- error tip will append here automatically -->

Trigger validation after submitted

methods: {    // vue methods
    handleSubmit() {
        let error = this.$validator.check().getError();
        if (error) {
            alert('has error');
            return
        }
    }
}

There are more powerful and flexible usage, see our documentation and demos

TODO

  • 规则number支持开区间
0.6.8

6 years ago

0.6.7

6 years ago

0.6.6

6 years ago

0.6.5

6 years ago

0.6.4

6 years ago

0.6.3

6 years ago

0.6.2

6 years ago

0.6.1

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago