🚩Validation plugin for Vue.js
Clone or download
Permalink
Failed to load latest commit information.
dist bump 0.4.0 Mar 3, 2017
examples Update demo Nov 3, 2016
media add logo file Nov 4, 2016
packages Publish Sep 30, 2016
src use simple-assign Mar 3, 2017
test fix parse object paths Dec 1, 2016
.eslintrc init Jul 15, 2016
.gitignore add directive Jul 17, 2016
.travis.yml Support multiple rule Sep 30, 2016
LICENSE Support multiple rule Sep 30, 2016
Makefile add directive Jul 17, 2016
README.md fix: compouted => computed Mar 1, 2017
lerna.json Update demo Nov 3, 2016
package.json -> v0.4.0 Mar 3, 2017
rollup.config.js use simple-assign Mar 3, 2017
yarn.lock add yarn.lock Mar 3, 2017

README.md

Vuerify

Build Status npm Coverage Status badge-size

Validation plugin for Vue.js

Features

  • Supports both Vue 1.x and 2.0
  • Compact
  • Simple

Demo

Docs

Installation

npm i vuerify -S

install directive

# Vue 1.x
npm i v-vuerify -S

# Vue 2.x
npm i v-vuerify-next -S

Usage

import Vue from 'vue'
import Vuerify from 'vuerify'

Vue.use(Vuerify /*, add rules */)

component

{
  template: `
    <form @submit.prevent="handleSubmit">
      <input type="text" v-model="username">
      <input type="password" v-model="password">
      <input type="password" v-model="conform">
      <input type="submit">
      <ul><li v-for="err in errors" v-text="err"></li></ul>
    </form>
  `,
  data () {
    return {
      username: '',
      password: '',
      conform: ''
    }
  },

  vuerify: {
    username: 'required',
    password: {
      test: /\w{4,}/,
      message: '至少四位字符'
    },
    conform: {
      test (val) {
        return val === this.password
      },
      message: '密码输入不一致'
    }
  },

  computed: {
    errors () {
      return this.$vuerify.$errors
    }
  },

  methods: {
    handleSubmit () {
      if (this.$vuerify.check()) {
        // do sth
      }
    }
  }
}

Development

npm install
npm run dev

TODO

  • English Documentation

License

WTFPL