Validation plugin for Vue.js
Features
- Supports both Vue 1.x and 2.0
- Compact
- Simple
Demo
- basic
- directive
- Directive for Vue2.0
- mint-ui
Docs
Installation
install directive
# Vue 1.x
npm i v-vuerify -S
# Vue 2.x
npm i v-vuerify-next -S
Copy the code
Usage
import Vue from 'vue' import Vuerify from 'vuerify' Vue.use(Vuerify, /* add rules */)
component
{
template: `
`, data () { return { username: '', password: '', conform: '' } }, vuerify: { username: 'required', password: { test: /\w{4,}/, message: 'at least four characters'}, conform: {test (val) {return val === this.password}, message: conform: {test (val) {return val === this. }}, compouted: {errors () {return this.$vuerify.$errors}}, methods: { handleSumit () { if (this.$vuerify.check()) { // do sth } } } }Copy the code
TODO
License
WTFPL